ygrunin
ygrunin

Reputation: 345

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

Upvotes: 0

Views: 2177

Answers (1)

micronyks
micronyks

Reputation: 55443

<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/

Upvotes: 1

Related Questions