Issue
I am unable to set a default value to ng-model="searchText". Here is the code I am using
<input ng-model="searchText" value="can you see me" />
Can anyone help me with this?
Solution
1st Solution: is to simply init the searchText in the controller.
App.controller('mainController',['$scope', function($scope) {
$scope.searchText = "can you see me";
}]);
2nd Solution: is to use ng-init insteat of value
<input ng-model="searchText" ng-init="searchText ='can you see me'"></input>
Answered By - Marwen Cherif
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.