Reputation: 13
Trying to initial a text box with ng-init but the text box is always blank?
<form ng-app="TheApp" ng-init="email='[email protected]'">
<div>
<label>email: </label>
<input type="text" ng-model="email">
</div>
</form>
Upvotes: 0
Views: 520
Reputation: 718
I don't know if you're starting your angular correctly. Dropping ="TheApp"
makes this work. See this fiddle.
In your app.js, are you defining your angular module as TheApp
? i.e. angular.module('TheApp', [])
<form ng-app ng-init="email = '[email protected]'">
<div>
<label>email: </label>
<input type="text" ng-model="email">
</div>
</form>
Upvotes: 2