Angularjs - $rootScope in directive link function

后端 未结 6 645
庸人自扰
庸人自扰 2021-01-30 10:57

I am asking this question because I am not quite clear on how to think of rootscope as a dependency passed to directives

I have a directive that needs to display some in

6条回答
  •  误落风尘
    2021-01-30 11:05

    It's not recommended to use the root scope to set and get properties in your angular application. Try using the $cacheFactory, since that way you can also cache some values over various requests. ($cacheFactory docs)

提交回复
热议问题