For scope, when should you use an independent scope and when should you inherit the scope of the parent class? Are there any application scenarios?
过去多啦不再A梦2017-05-15 16:55:29
Normally, it is not recommended to rely on the inheritance relationship of the scope to transfer data. Data can be transferred through angular's pub/sub, or data between different scopes can be shared through service. The directive will generate an independent scope only after you specify the scope parameter. The independent scope is for interface isolation and only provides limited external access rights, so that the component can be reused in different environments to implement web components.
習慣沉默2017-05-15 16:55:29
Independent components use independent scopes. I feel that in accordance with the componentization concept and performance tuning considerations, independent scopes should be mainly used, and scopes that inherit controller should be avoided as much as possible. According to my practice in the project, I feel that using the controller scope often causes various headaches.