diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index 3a798ffed3..2a1a5803af 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -585,7 +585,6 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges */ this.pushFromTemplate = function(templateUrl) { var childScope = $scope.$new(); - childScope.isVisible = true; // Load the given template TemplateLoader.load(templateUrl).then(function(templateString) { @@ -650,6 +649,8 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges return function($scope, $element, $attr, navCtrl) { var lastParent, lastIndex, childScope, childElement; + $scope.isVisible = true; + $scope.$watch('isVisible', function(value) { // Taken from ngIf if(childElement) { @@ -662,7 +663,7 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges } if(value) { - childScope = $scope; + childScope = $scope.$new(); transclude(childScope, function(clone) { childElement = clone; diff --git a/js/ext/angular/src/directive/ionicNav.js b/js/ext/angular/src/directive/ionicNav.js index 8b13cc26a4..eba7ad7380 100644 --- a/js/ext/angular/src/directive/ionicNav.js +++ b/js/ext/angular/src/directive/ionicNav.js @@ -40,7 +40,6 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges */ this.pushFromTemplate = function(templateUrl) { var childScope = $scope.$new(); - childScope.isVisible = true; // Load the given template TemplateLoader.load(templateUrl).then(function(templateString) { @@ -105,6 +104,8 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges return function($scope, $element, $attr, navCtrl) { var lastParent, lastIndex, childScope, childElement; + $scope.isVisible = true; + $scope.$watch('isVisible', function(value) { // Taken from ngIf if(childElement) { @@ -117,7 +118,7 @@ angular.module('ionic.ui.nav', ['ionic.service.templateLoad', 'ionic.service.ges } if(value) { - childScope = $scope; + childScope = $scope.$new(); transclude(childScope, function(clone) { childElement = clone; diff --git a/js/ext/angular/test/nav.html b/js/ext/angular/test/nav.html index d33cf823ba..46b8d6679c 100644 --- a/js/ext/angular/test/nav.html +++ b/js/ext/angular/test/nav.html @@ -73,6 +73,11 @@ .controller('CatsCtrl', function($scope, $compile, $element) { console.log('Cats', $element); + var items = []; + for(var i = 0; i < 100; i++) { + items.push({}); + } + $scope.items = items; $scope.goNext = function() { $scope.navController.pushFromTemplate('page.html'); };