Directives - AngularJS -


i have 2 questions relating directives. first question relates injecting provider. have used compile directive example listed on angularjs web site. in example states create module , create directive module

// declare new module, , inject $compileprovider angular.module('compile', [], function($compileprovider) {   // configure new 'compile' directive passing directive   // factory function. factory function injects '$compile'  $compileprovider.directive('compile', function($compile) {... 

in application in create directive so

myapp.directive('compile', function($compile) {... 

i haven't referred $compileprovider anywhere in code, code still works , compiles templates quiet well. why that?

also, although works when compiling templates seem work except when compile 'switch' statement. 'switch' statements not seem link scope, other elements compile without problem. related fact haven't injected $compileprovider or there switch statements require step when compiling?

thanks frank

it works , compiles templates quite because module.directive shorthand $compileprovider.directive. docs module.directive refer $compileprovider.directive.

as using switch inside directives, can provide example of how you're doing this? depending on you're switching on , you're doing it, may defining directive incorrectly. example, if you're switching inside of directive callback, it's going executed once, 1 of case statements win , create 1 directive.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -