Hello. I want to make a directive with a switch between template and 
templateUrl. I'll write a little example.

<my-menu template-url='/admin/my-template'> </my-menu>

angular
  .module('MyModule', [])
  .directive('myMenu', function($compile){
    var x = false;
    var y = function(scope, element){
      return (element.templateUrl) : false ? '<div>You should give 
template-url</div>'
    }
  return{
    restrict: 'E',
    replace: true,
    template: y,
    templateUrl: '/admin/my-template'(i hard coded inhere) 
  }
  })


If i use "template: x" it works. template will be false and i get my 
templateUrl, but with a simple function that will return false i get an 
error:
https://docs.angularjs.org/error/$compile/tplrt?p0=myMenu&p1=

Can i do something in this case? I really want to evaluate my directive 
scopes before. Thx and sorry for not having a plunker

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to