Some one suggest me the good approach.
You're better at sharing data with a service. This way is more explicit which component maintains data. As best practices goes, avoid sharing data on scope, either by $rootScope or child/inherited scopes/controllers.
Hi André Werlang,
I need to know whether any issues will happen (like performance issue) or not while using $rootScope.
I need to know whether any issues will happen (like performance issue) or not while using $rootScope.
Performance is the same. However, it's a poor choice for those concerned with maintainability. As application grows, that can lead to name clashes and lost focus on responsibility over data and/or functions. Usage $rootScope will never figure in a best practices article and could even go away as angular evolves (>=2.0...) .
I've not done this myself but for passing "values" between controllers I'd consider https://github.com/
댓글 없음:
댓글 쓰기