AngularJS : The correct way of binding to a service properties

前端 未结 10 1848
天命终不由人
天命终不由人 2020-11-28 00:30

I’m looking for the best practice of how to bind to a service property in AngularJS.

I have worked through multiple examples to understand how to bind to properties

10条回答
  •  半阙折子戏
    2020-11-28 00:47

    I think it's a better way to bind on the service itself instead of the attributes on it.

    Here's why:

    
    
    
      
    ArrService.arrOne: {{v}}
    ArrService.arrTwo: {{v}}

    arrOne: {{v}}
    arrTwo: {{v}}

    You can play it on this plunker.

提交回复
热议问题