ng-init not working to initialize ng-model for textbox

I am trying to initialize my model with value 0,such that text box is by default populated with 0. But textbox is not prepopulating.

  • Please Note:

  • I dont want model to initialize in controller.

  • I have already initialized $scope.discharge = {} in controller

<body ng-app>
     <div ng-controller="testController" >
        <input ng-init=" = 0 " class=" form-control" type="text" ng-model="" disabled>       


ngInit is used to evaluate expressions. Check how its used here.

you can do something like this though

 <div ng-init=" = 5">

check why yours wont work is here

  <input ng-init="discharge = 0 " class=" form-control"
 type="text" ng-model="" disabled>{{discharge}}</input>

Need Your Help

Count unique occurrences of a field across multiple files

bash awk

I have a large collection of log files where each file contains records of the form ...

How to save NSDictionaries?

iphone objective-c database xcode nsdictionary

Could you tell me please, how can I make something like this: