I have a problem with my code. In my app I have 2 controllers one is to load all the data and the second is to display a tab.
Here's the setup:
<div class="row" ng-app="quotation_list">
<div class="col-md-12" ng-controller="quoteList">
<section ng-controller="PanelController as panel">
<div class="panel pane-default" ng-show="panel.isSelected(1)">
...
<div class="row">
<div class="form-group">
<label>VAT(%): </label>
<input type="number" class="form-control text-right" ng-model="vat_rate" />
</div>
</div>
<button class="btn btn-default" type="button" ng-click="computePercentage()">TEST VALUE</button>
</div>
</section>
</div>
</div>
And I am trying to get the value of the model vat_rate but what I got is undefined value
Here's my function for that:
var quotationList = angular.module('quotation_list', ['jsonFormatter','ui.bootstrap','ckeditor']);
quotationList.controller('quoteList', function($scope, $http) {
//some codes ...
$scope.computePercentage = function() {
console.log($scope.vat_rate);
}
});
I don't know where's my error. And one more question is it fine if I create a controller inside a controller? Just like what I did?
Ok that's all I hope you can help me. :)