Here is a snippet of my code where I am attempting to switch between two different template URLs. It seems to only work when the page is refreshed and data is being held in either localstorage or the backend.
app.directive('myPanel', ['myService', function(myService) {
if(myService.isThisTrue()) {
return {
restrict: 'E',
templateUrl: '/views/isTrue.html'
}
} else {
return {
restrict: 'E',
templateUrl: '/views/isFalse.html'
}
}
}]);
I have not yet come across a more efficient way to achieve this task. Is there anyone who can suggest a better solution?