javascript - passing value to <input> with angular.js -
i cannot find problem here, why cant see value in
html:
'<div ng-app="businessinfomodule" ng-controller="businessinfocontroller" <label>your business name</label> <input type="text" class="form-control" name="bussiness" ng-model="bussiness" ng-maxlength="100" required> </div>'
and controller:
angular.module('businessinfomodule', []) .controller('businessinfocontroller', function($scope) { $scope.business = 'aaa'; });
here codepen: http://codepen.io/anon/pen/gjggee
<div ng-app="businessinfomodule" ng-controller="businessinfocontroller" > <label>your business name</label> <input type="text" class="form-control" name="bussiness" ng-model="business " //ng-model binds controller scope ui. ng-maxlength="100" required/> </div> angular.module('businessinfomodule', []) .controller('businessinfocontroller', function($scope) { $scope.business = 'aaa'; });
https://jsfiddle.net/ncoxq6zf/
Comments
Post a Comment