Skip to main content
deleted 2 characters in body
Source Link
Joe
  • 13
  • 4

I recently started exploring AngularJS. I saw some similar questions but I'm quite sure that there isn't any scope problem here. (or maybe my understanding of scope isn't clear.)

JS Code:

var app = angular.module("myApp", []);
app.controller("myController", function($scope){
$scope.b=50000
$scope.apr=10
$scope.hc=$scope.buab/$scope.apr
...
})

HTML:

<div ng-app="myApp" ng-controller="myController">
<span class="inp-heading">b:</span>
<input ng-model="b" type="number" step="1000" min="0" />
<input ng-model="apr" type="number" step="1" min="0" />
{{b}} <br /> <!-- this updates on input value change -->
{{hc}} <br /> <!-- this does NOT update on input value change -->
{{b/apr}} <br /> <!-- this updates on input value change -->

As mentioned in the comments (in the HTML code above) $scope.hc doesn't change. This isn't the only issue actually, I'm facing similar trouble while binding array values to input boxes.

Any help would be appreciated.

I recently started exploring AngularJS. I saw some similar questions but I'm quite sure that there isn't any scope problem here. (or maybe my understanding of scope isn't clear.)

JS Code:

var app = angular.module("myApp", []);
app.controller("myController", function($scope){
$scope.b=50000
$scope.apr=10
$scope.hc=$scope.bua/$scope.apr
...
})

HTML:

<div ng-app="myApp" ng-controller="myController">
<span class="inp-heading">b:</span>
<input ng-model="b" type="number" step="1000" min="0" />
<input ng-model="apr" type="number" step="1" min="0" />
{{b}} <br /> <!-- this updates on input value change -->
{{hc}} <br /> <!-- this does NOT update on input value change -->
{{b/apr}} <br /> <!-- this updates on input value change -->

As mentioned in the comments (in the HTML code above) $scope.hc doesn't change. This isn't the only issue actually, I'm facing similar trouble while binding array values to input boxes.

Any help would be appreciated.

I recently started exploring AngularJS. I saw some similar questions but I'm quite sure that there isn't any scope problem here. (or maybe my understanding of scope isn't clear.)

JS Code:

var app = angular.module("myApp", []);
app.controller("myController", function($scope){
$scope.b=50000
$scope.apr=10
$scope.hc=$scope.b/$scope.apr
...
})

HTML:

<div ng-app="myApp" ng-controller="myController">
<span class="inp-heading">b:</span>
<input ng-model="b" type="number" step="1000" min="0" />
<input ng-model="apr" type="number" step="1" min="0" />
{{b}} <br /> <!-- this updates on input value change -->
{{hc}} <br /> <!-- this does NOT update on input value change -->
{{b/apr}} <br /> <!-- this updates on input value change -->

As mentioned in the comments (in the HTML code above) $scope.hc doesn't change. This isn't the only issue actually, I'm facing similar trouble while binding array values to input boxes.

Any help would be appreciated.

Source Link
Joe
  • 13
  • 4

AngularJS binding not updating model

I recently started exploring AngularJS. I saw some similar questions but I'm quite sure that there isn't any scope problem here. (or maybe my understanding of scope isn't clear.)

JS Code:

var app = angular.module("myApp", []);
app.controller("myController", function($scope){
$scope.b=50000
$scope.apr=10
$scope.hc=$scope.bua/$scope.apr
...
})

HTML:

<div ng-app="myApp" ng-controller="myController">
<span class="inp-heading">b:</span>
<input ng-model="b" type="number" step="1000" min="0" />
<input ng-model="apr" type="number" step="1" min="0" />
{{b}} <br /> <!-- this updates on input value change -->
{{hc}} <br /> <!-- this does NOT update on input value change -->
{{b/apr}} <br /> <!-- this updates on input value change -->

As mentioned in the comments (in the HTML code above) $scope.hc doesn't change. This isn't the only issue actually, I'm facing similar trouble while binding array values to input boxes.

Any help would be appreciated.