深入 AngularJS directive - GeekStudioHIT/Web-Front-End GitHub Wiki
- directive 绑定 controller
- 代码
- 在 directive 的使用时,给 directive 套上一个个的 controller,并且给 directive 附加上一个个的 attribute。
- 在一个个的 controller 中,实现相应 directive 所附加 attribute 上的内容。
- 在 directive 的 link 中,用 attrs. 去获取 directive 所附加 attribute 内容,再将其用 scope.$apply 去绑定相应的控制器。