From f562c31e824f573d9a3254a1eacb4981b29290eb Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Fri, 12 May 2017 01:49:57 +0800 Subject: add web portal framework for TestAPI Change-Id: I62cea8b59ffe6a6cde98051c130f4502c07d3557 Signed-off-by: SerenaFeng --- .../assets/lib/angular-ui-router/src/view.js | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/angular-ui-router/src/view.js (limited to 'utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/angular-ui-router/src/view.js') 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 + * + *
+         * $scope.$on('$viewContentLoading',
+         * function(event, viewConfig){
+         *     // Access to all the view config properties.
+         *     // and one special property 'targetView'
+         *     // viewConfig.targetView
+         * });
+         * 
+ */ + $rootScope.$broadcast('$viewContentLoading', options); + } + return result; + } + }; + } +} + +angular.module('ui.router.state').provider('$view', $ViewProvider); -- cgit 1.2.3-korg