0

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

ygrunin
  • 325
  • 1
  • 4
  • 15

1 Answers1

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

micronyks
  • 54,797
  • 15
  • 112
  • 146
  • When controller gets executed it uses business scope which has 'aaa' value and if you look at in html the scope of your controller named BusinessinfoController ,it is defined for whole div. so your ng-model binds scope value to ui. (it plays two way Binding) – micronyks Apr 25 '15 at 07:40
  • Open your browser console and let me know which errors occur? – micronyks Apr 25 '15 at 07:44