Domanda

angular.module('mod1', [])
  .directive('myDir', ($timeout) => {
    return {
      ///....
    }
  });

angular.module('myApp', ['mod1'])
<html ng-app="myApp">

<body>
  <my-dir valu='blablabla' />
</body>

</html>

So why this wouldn't work? and say Unknown provider: $compileProvider,

but if I move directive into myApp module it works

È stato utile?

Soluzione

I think it should work fine as long as module dependency has been provided correctly !!

Check this out : http://plnkr.co/edit/Wvb7melvMOgXh3FyoVnx?p=preview

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top