Is it possible to apply multiple AngularJS controllers on the same element

后端 未结 6 1653
悲哀的现实
悲哀的现实 2021-01-31 08:58

Is it possible to apply multiple AngularJS controllers on the same element ?

6条回答
  •  死守一世寂寞
    2021-01-31 09:44

    I've just been faced with the same problem trying to code the tabs with container and I'm going to use a directive, which wraps the content using ng-transclude - this way it will be just one controller for the content and I'll then define another controller on the directive, which can be re-used multiple times with whatever content necessary.

提交回复
热议问题