My Angular application needs to resolve data before the controller is loaded. I am using the answer provided here by tasseKATT:
Apply loading spinner during ui-router resolve
Though I am curious as to why I can use "template" but not "templateUrl."
Works:
app.directive('resolveLoader', function($rootScope, $timeout) {
return {
restrict: 'E',
replace: true,
template: '<div class="alert alert-success ng-hide"><strong>Welcome!</strong> Content is loading, please hold.</div>',
link: function(scope, element) {...
Does not work:
app.directive('resolveLoader', function($rootScope, $timeout) {
return {
restrict: 'E',
replace: true,
templateUrl: 'loadingView.html',
link: function(scope, element) {...
Please see the modified Plunker below (which does not work properly):