angularjs - ng-init not working to initialize data -
in angularjs, ng-init not working initialize data before executing template. example, index.html
<div class="control-group"> <label class="control-label label-bold">shipping first name :</label> <div class="controls"> <input class="control-width" validation-errors="contactdata" maxlength="50" type="text" id="shipping_first_name" placeholder="first name" ng-model="contactdata.data.shopcustomer.shipping_first_name" ng-init="contactdata.data.shopcustomer.shipping_first_name='abc'"> </div> </div>
how initial value in angularjs?
here fiddle : http://jsfiddle.net/aasquare3/2xdvt/
working fiddle - abc
shows in textbox/input.
your fiddle wasn't including angular, added v1.0.3, , specified "no wrap - in <body>".
the body
tag did not have ng-app
, specified <body ng-app>
under "fiddle options".
Comments
Post a Comment