diff options
Diffstat (limited to 'utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/angular-ui-router/src/view.js')
-rw-r--r-- | utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/angular-ui-router/src/view.js | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/angular-ui-router/src/view.js b/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/angular-ui-router/src/view.js new file mode 100644 index 000000000..f19a3c569 --- /dev/null +++ b/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/angular-ui-router/src/view.js @@ -0,0 +1,71 @@ + +$ViewProvider.$inject = []; +function $ViewProvider() { + + this.$get = $get; + /** + * @ngdoc object + * @name ui.router.state.$view + * + * @requires ui.router.util.$templateFactory + * @requires $rootScope + * + * @description + * + */ + $get.$inject = ['$rootScope', '$templateFactory']; + function $get( $rootScope, $templateFactory) { + return { + // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... }) + /** + * @ngdoc function + * @name ui.router.state.$view#load + * @methodOf ui.router.state.$view + * + * @description + * + * @param {string} name name + * @param {object} options option object. + */ + load: function load(name, options) { + var result, defaults = { + template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {} + }; + options = extend(defaults, options); + + if (options.view) { + result = $templateFactory.fromConfig(options.view, options.params, options.locals); + } + if (result && options.notify) { + /** + * @ngdoc event + * @name ui.router.state.$state#$viewContentLoading + * @eventOf ui.router.state.$view + * @eventType broadcast on root scope + * @description + * + * Fired once the view **begins loading**, *before* the DOM is rendered. + * + * @param {Object} event Event object. + * @param {Object} viewConfig The view config properties (template, controller, etc). + * + * @example + * + * <pre> + * $scope.$on('$viewContentLoading', + * function(event, viewConfig){ + * // Access to all the view config properties. + * // and one special property 'targetView' + * // viewConfig.targetView + * }); + * </pre> + */ + $rootScope.$broadcast('$viewContentLoading', options); + } + return result; + } + }; + } +} + +angular.module('ui.router.state').provider('$view', $ViewProvider); |