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

6
  • What is this? Put proper code.
    – micronyks
    Commented Apr 25, 2015 at 7:27
  • your controller code is missing. Also, for proper formatting, just paste the code into the textfield, highlight the code, and press control + k (or click on the code button).
    – tim
    Commented Apr 25, 2015 at 7:28
  • sorry, here the better now
    – ygrunin
    Commented Apr 25, 2015 at 7:28
  • did you add the reference to angular js script ?
    – Rad
    Commented Apr 25, 2015 at 7:31
  • 2
    Your ng-model name is different from that in controller. bussiness & business, is that a typo?
    – Zee
    Commented Apr 25, 2015 at 7:51

1 Answer 1

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/

2
  • 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
    Commented Apr 25, 2015 at 7:40
  • Open your browser console and let me know which errors occur?
    – micronyks
    Commented Apr 25, 2015 at 7:44

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.