2 $ViewProvider.$inject = [];
3 function $ViewProvider() {
8 * @name ui.router.state.$view
10 * @requires ui.router.util.$templateFactory
11 * @requires $rootScope
16 $get.$inject = ['$rootScope', '$templateFactory'];
17 function $get( $rootScope, $templateFactory) {
19 // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })
22 * @name ui.router.state.$view#load
23 * @methodOf ui.router.state.$view
27 * @param {string} name name
28 * @param {object} options option object.
30 load: function load(name, options) {
31 var result, defaults = {
32 template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}
34 options = extend(defaults, options);
37 result = $templateFactory.fromConfig(options.view, options.params, options.locals);
39 if (result && options.notify) {
42 * @name ui.router.state.$state#$viewContentLoading
43 * @eventOf ui.router.state.$view
44 * @eventType broadcast on root scope
47 * Fired once the view **begins loading**, *before* the DOM is rendered.
49 * @param {Object} event Event object.
50 * @param {Object} viewConfig The view config properties (template, controller, etc).
55 * $scope.$on('$viewContentLoading',
56 * function(event, viewConfig){
57 * // Access to all the view config properties.
58 * // and one special property 'targetView'
59 * // viewConfig.targetView
63 $rootScope.$broadcast('$viewContentLoading', options);
71 angular.module('ui.router.state').provider('$view', $ViewProvider);