javascript - ion-content and ion-footer have different $scope -


i have 2 input fields inside ion-content , both have ng-model attached them. inside ion-footer have ng-click call function , pass in 2 ng-models.

this worked fine when had ng-click inside ion-content, when move footer undefined 2 parameters pass function.

so mean ion-content , ion-footer have different $scope's? though they're in same file , have same controller??

i believe ion-footer & ion-content creates new child scope prototypically inerherit current scope. below ionic code give better illustration how works internally, scope: true, responsible creating new child scope.

code

.directive('ioncontent', [   '$parse',   '$timeout',   '$ionicscrolldelegate',   '$controller',   '$ionicbind', function($parse, $timeout, $ionicscrolldelegate, $controller, $ionicbind) {   return {     restrict: 'e',     replace: true,     transclude: true,     require: '^?ionnavview',     scope: true, //<-- creates prototypically inerherited scope     template:     '<div class="scroll-content">' +       '<div class="scroll"></div>' +     '</div>', 

you need use . annotation fix problem

eg.

if using variable primitive like

$scope.volume = 5 

then need use:

$scope.data = { 'volume' : 5} 

angular prototypal scope inheritance


Comments