Wednesday, February 24, 2016

ANGULARJS - how dynamically set templateUrl to derective

emanuel.directive('hymn', function() {
   return {
       restrict: 'E',
       link: function(scope, element, attrs) {
           // some ode
       },
       templateUrl: function(elem,attrs) {
           return attrs.templateUrl || 'some/path/default.html'
       }
   }
});
 <hymn template-url="contentUrl"><hymn>
http://stackoverflow.com/questions/21835471/angular-js-directive-dynamic-templateurl

JAVASCRIPT - Introduction to JavaScript by Yakov Fain (video)