简体   繁体   中英

passing value to <input> with angular.js

i cannot find a problem here, why i cant see the value in the

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 the controller:

angular.module('BusinessinfoModule', [])
  .controller('BusinessinfoController', function($scope) {
    $scope.business = 'aaa';
  });

Here the 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 which binds your controller scope to ui.
     ng-maxlength="100" 
     required/>

</div>





angular.module('BusinessinfoModule', [])
  .controller('BusinessinfoController', function($scope) {
    $scope.business = 'aaa';
  });

https://jsfiddle.net/ncoxq6zf/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM