AngularJS Tutorial 18- $rootScope

Опубликовано: 07 Январь 2017
на канале: Nisha Singla
4,355
77

In this tutorial, we will learn what is $rootScope in AngularJS and how is it differ from $scope object

In our previous tutorials, we have already covered $scope object that acts like the bridge between your JS code (Controller) and view
In AngularJS each Controller has its own $scope object that is used to bind properties and methods to specific controller

On the other hand $rootScope works on the root level so $rootScope act like a global variable. You can have single $rootscope per application and the $scope of $rootscope is inherited in its own child scope.

All $scopes objects get inherited from $rootScope object.
To use $rootScope you need to inject $rootScope object inside a function run() method that you will create on module object

app.run(function($rootScope){
$rootScope.name="Angular Main App";
});
Visit complete playlist on angular js @    • AngularJS Tutorial 1  -  Introduction  

Visit my facebook page@

  / angularjs4beginners  


На этой странице сайта вы можете посмотреть видео онлайн AngularJS Tutorial 18- $rootScope длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Nisha Singla 07 Январь 2017, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 4,355 раз и оно понравилось 77 зрителям. Приятного просмотра!