search

Home  >  Q&A  >  body text

javascript - How to define a shared directive in angularjs

Now I have multiple unknown modules that need to share a directive, but I need to specify the module when defining. How should I define a common directive. You can define a global function to return a directive, but you don’t want to pollute the global environment. What should be the best way to do it?

淡淡烟草味淡淡烟草味2757 days ago604

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-15 17:15:44

    Create a new module directly and define the directive in the module. Wherever you need this directive, can you just declare the dependency in the corresponding module?

    reply
    0
  • Cancelreply