Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,6 @@ function $ViewProvider() {
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;
}
};
Expand Down
22 changes: 17 additions & 5 deletions src/viewDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
scope.$on('$stateChangeSuccess', function() {
updateView(false);
});
scope.$on('$viewContentLoading', function() {
updateView(false);
});

updateView(true);

Expand Down Expand Up @@ -216,6 +213,20 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
newScope = scope.$new();
latestLocals = $state.$current.locals[name];

/**
* @ngdoc event
* @name ui.router.state.directive:ui-view#$viewContentLoading
* @eventOf ui.router.state.directive:ui-view
* @eventType emits on ui-view directive scope
* @description
*
* Fired once the view **begins loading**, *before* the DOM is rendered.
*
* @param {Object} event Event object.
* @param {string} viewName Name of the view.
*/
newScope.$emit('$viewContentLoading', name);

var clone = $transclude(newScope, function(clone) {
renderer.enter(clone, $element, function onUiViewEnter() {
if(currentScope) {
Expand All @@ -236,12 +247,13 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
* @name ui.router.state.directive:ui-view#$viewContentLoaded
* @eventOf ui.router.state.directive:ui-view
* @eventType emits on ui-view directive scope
* @description *
* @description
* Fired once the view is **loaded**, *after* the DOM is rendered.
*
* @param {Object} event Event object.
* @param {string} viewName Name of the view.
*/
currentScope.$emit('$viewContentLoaded');
currentScope.$emit('$viewContentLoaded', name);
currentScope.$eval(onloadExp);
}
};
Expand Down