This callback is called when the view's state is about to be exited.
This callback is called when the view's state is about to be exited.
This callback is used to inform a view that it is about to be exited, due to a new Transition. The callback can ask for user confirmation, and cancel or alter the new Transition. The callback should return a value, or a promise for a value. If a promise is returned, the new Transition waits until the promise settles.
Called when:
Called with:
Relevant return Values:
false
: The transition is cancelled.app.component('myComponent', {
template: '<input ng-model="$ctrl.data" type="text">',
bindings: { 'data': '<' },
controller: function() {
this.originalData = angular.copy(this.data);
this.uiCanExit = function() {
if (!angular.equals(this.data, this.originalData)) {
// Note: This could also return a Promise and request async
// confirmation using something like ui-bootstrap $modal
return window.confirm("Data has changed. Exit anyway and lose changes?");
}
}
}
}
the new Transition that is about to exit the component's state
a HookResult, or a promise for a HookResult
This callback is called when parameter values have changed.
This callback is called when parameter values have changed.
This callback can be used to respond to changing parameter values in the current state, or in parent/child states. This callback is especially handy when using dynamic parameters (ParamDeclaration.dynamic)
Called when:
Called with:
an object containing the changed parameter values
the new Transition which triggered this callback
angular.module('foo').controller('FancyCtrl', function() {
this.uiOnParamsChanged = function(newParams) {
console.log("new params: ", newParams);
}
});
Generated using TypeDoc
The shape of a controller for a view (and/or component), defining the controller callbacks.
A view in UI-Router is comprised of either a
component
(Ng1ViewDeclaration.component) or a combination of atemplate
(ortemplateProvider
) and acontroller
(orcontrollerProvider
).The
controller
object (or thecomponent
's controller object) can define component-level controller callbacks, which UI-Router will call at the appropriate times. These callbacks are similar to Transition Hooks (IHookRegistry), but are only called if the view is currently active.This interface defines the UI-Router component callbacks.