I have several partial templates where the location changes based on user actions via ng-click:
<div ng-include="contentUrl"></div> <button ng-click="contentUrl = '../partials/testScriptForm.html'">Add Test Script</button>
This works fine if I don't find the above in the partial part, so if testScriptForm.html has a button:
<button ng-click="contentUrl = '../partials/testScriptCase.html'">Add Test Case</button>
Then nothing happens.
This is because ng-include gets a new (inherited but not shared?) Area.
I cannot figure out how to get the included template (partial) to change its own location.
I tried a function to change $ scope. $ parent.contentUrl, it seems to be changing, but not “propagating” the changes.
In coffeescript:
$scope.changeParentLocation = (location) -> $scope.$parent.contentUrl = location
Also tried using $ scope. $ apply () and $ scope. $ parent. $ apply () there and get the error:
Error: [$ rootScope: inprog] http://errors.angularjs.org/1.2.0rc1/ $ rootScope / inprog? p0 =% 24apply
Maybe I'm just misusing it ...
source share