Commit 945aa436 authored by Phạm Duy Phi's avatar Phạm Duy Phi

Merge branch 'master' into phipham

# Conflicts:
#	src/main/resources/application.properties
#	src/main/resources/public/index.html
#	src/main/resources/public/js/app.js
parents ff6ce725 db1759c0
This source diff could not be displayed because it is too large. You can view the blob instead.
# Report an Issue
Help us make UI-Router better! If you think you might have found a bug, or some other weirdness, start by making sure
it hasn't already been reported. You can [search through existing issues](https://github.com/angular-ui/ui-router/search?q=wat%3F&type=Issues)
to see if someone's reported one similar to yours.
If not, then [create a plunkr](http://bit.ly/UIR-Plunk) that demonstrates the problem (try to use as little code
as possible: the more minimalist, the faster we can debug it).
Next, [create a new issue](https://github.com/angular-ui/ui-router/issues/new) that briefly explains the problem,
and provides a bit of background as to the circumstances that triggered it. Don't forget to include the link to
that plunkr you created!
**Note**: If you're unsure how a feature is used, or are encountering some unexpected behavior that you aren't sure
is a bug, it's best to talk it out on
[StackOverflow](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) before reporting it. This
keeps development streamlined, and helps us focus on building great software.
Issues only! |
-------------|
Please keep in mind that the issue tracker is for *issues*. Please do *not* post an issue if you need help or support. Instead, see one of the above-mentioned forums or [IRC](irc://irc.freenode.net/#angularjs). |
#### Purple Labels
A purple label means that **you** need to take some further action.
- ![Not Actionable - Need Info](https://angular-ui.github.io/ui-router/ngdoc_assets/incomplete.png): Your issue is not specific enough, or there is no clear action that we can take. Please clarify and refine your issue.
- ![Plunkr Please](https://angular-ui.github.io/ui-router/ngdoc_assets/example.png): Please [create a plunkr](http://bit.ly/UIR-Plunk)
- ![StackOverflow](https://angular-ui.github.io/ui-router/ngdoc_assets/so.png): We suspect your issue is really a help request, or could be answered by the community. Please ask your question on [StackOverflow](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router). If you determine that is an actual issue, please explain why.
If your issue gets labeled with purple label, no further action will be taken until you respond to the label appropriately.
# Contribute
**(1)** See the **[Developing](#developing)** section below, to get the development version of UI-Router up and running on your local machine.
**(2)** Check out the [roadmap](https://github.com/angular-ui/ui-router/milestones) to see where the project is headed, and if your feature idea fits with where we're headed.
**(3)** If you're not sure, [open an RFC](https://github.com/angular-ui/ui-router/issues/new?title=RFC:%20My%20idea) to get some feedback on your idea.
**(4)** Finally, commit some code and open a pull request. Code & commits should abide by the following rules:
- *Always* have test coverage for new features (or regression tests for bug fixes), and *never* break existing tests
- Commits should represent one logical change each; if a feature goes through multiple iterations, squash your commits down to one
- Make sure to follow the [Angular commit message format](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format) so your change will appear in the changelog of the next release.
- Changes should always respect the coding style of the project
# Developing
UI-Router uses <code>npm</code> and <code>Rollup</code>.
## Fetch the source code
The code for Angular UI-Router is split into two source repositories:
* [UI-Router Core](https://github.com/ui-router/core) (`@uirouter/core` on npm)
* [UI-Router for Angular 1](https://github.com/angular-ui/ui-router) (`@ui-router/angularjs` on npm)
Clone both repositories into directories next to each other.
```
mkdir uirouter
cd uirouter
git clone https://github.com/angular-ui/ui-router.git angularjs
git clone https://github.com/ui-router/core.git core
```
## Install dependencies
Use `npm` to install the development dependencies for each repository.
```
cd core
npm install
cd ../angularjs
npm install
cd ..
```
## Link the directories
This step is necessary if you need to modify any code in `@uirouter/core`.
Using `npm`, link `@uirouter/core` into `@uirouter/angularjs`
```
cd core
npm link
cd ../angularjs
npm link '@uirouter/core'
```
After executing these steps, `@uirouter/angularjs` will be depend on your local copy of `@uirouter/core` instead of the version listed in `package.json`.
## Develop
These scripts may be run in the `angularjs` directory:
* `npm run build`: Compiles TypeScript source
* `npm run package`: Compiles TypeScript source and creates the Rollup bundles.
* `npm test`: Runs the test suite (against Angular 1.2 through 1.5).
* `npm run watch`: Continuously compiles the source and runs the test suite (when either source or tests change).
Scripts of the same name (in the `core` directory) can be used.
* `npm run build`: Compiles `@uirouter/core` TypeScript source
* `npm test`: Runs the `@uirouter/core` test suite
* `npm run watch`: Continuously compiles the source and runs the `@uirouter/core` test suite (when core source or tests change).
If you've followed the [linking instructions](#link-the-directories), it's useful to run both
`npm run watch` tasks (each task from `@uirouter/core` *and* `@uirouter/angularjs`).
This ensures that changes to either `@uirouter/core` and `@uirouter/angularjs` compile successfully and are run against their test suites.
# [UI Router for Angular 1](https://ui-router.github.io/ng1/docs/latest)
#### The de-facto solution to flexible routing in angular 1
<div style="display: flex;">
<iframe style="display: inline-block;" src="https://ghbtns.com/github-btn.html?user=angular-ui&repo=ui-router&type=fork&count=true&size=medium" frameborder="0" scrolling="0" width="110px" height="20px"></iframe>
<iframe style="display: inline-block;" src="https://ghbtns.com/github-btn.html?user=angular-ui&repo=ui-router&type=star&count=true&size=medium" frameborder="0" scrolling="0" width="110px" height="20px"></iframe>
[![Build Status](https://travis-ci.org/angular-ui/ui-router.svg?branch=master)](https://travis-ci.org/angular-ui/ui-router)
</div>
Angular UI-Router is a client-side [Single Page Application](https://en.wikipedia.org/wiki/Single-page_application)
routing framework for [AngularJS](http://angularjs.org).
**[View on Github](http://github.com/angular-ui/ui-router) |**
**[Tutorials](https://ui-router.github.io/ng1/tutorials/)** |
**[Guides](https://ui-router.github.io/guide) |**
**[Sample App](http://ui-router.github.io/resources/sampleapp/) |**
**[Wiki](https://github.com/angular-ui/ui-router/wiki) |**
**[FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions)**
#### API Documentation Organization
The documentation is arranged according to API concern, such as `url`, `resolve`, and `core`.
For a list of services and objects that can be injectable, see the [`injectables` section](./injectables.html).
By default, only the public UI-Router API is shown.
To view both public API and the internal APIs, check the "Internal UI-Router API" checkbox.
#### Typescript
UI-Router is written in Typescript.
The API documentation is generated using [TypeDoc](https://github.com/TypeStrong/typedoc).
The documentation reflects the Typescript classes, interfaces, and parameter types information embedded in the source code.
#### Contributing
Angular UI-Router depends on the framework agnostic `@uirouter/core`.
To contribute to the documentation, please submit a PR to either
[@uirouter/angularjs](http://github.com/angular-ui/ui-router)
or
[@uirouter/core](http://github.com/ui-router/core).
To find where a specific piece of documentation is written, follow the links that say:
> _Defined in ui-router/somedir/somefile.ts_
This issue tracker is for Bug Reports and Feature Requests only.
Please direct requests for help to StackOverflow.
See http://bit.ly/UIR-SOF for details.
This is a (check one box):
- [ ] Bug Report
- [ ] Feature Request
- [ ] General Query
My version of UI-Router is: (type version)
# Bug Report
#### Current Behavior:
(type current behavior here)
#### Expected Behavior:
(type expected behavior here)
#### Link to Plunker or stackblitz that reproduces the issue:
( if you want a response to your issue, provide a way to reproduce it )
( http://bit.ly/UIR-Plunk1 )
( https://stackblitz.com/edit/ui-router-angularjs )
# Feature Request
(type feature request here)
# General Query
Please direct general implementation questions to StackOverflow:
http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router
Please review the Sample Application which highlights common approaches:
https://github.com/ui-router/sample-app-angularjs
- [ ] I have already asked my question on StackOverflow and nobody could answer the question
- [ ] I have already reviewed the sample application for examples of common approaches
- [ ] I believe my question can only be answered by the UI-Router maintainers
(type general query here)
The MIT License
Copyright (c) 2013-2018 The AngularUI Team, Karsten Sperling
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
# AngularUI Router &nbsp;[![Build Status](https://travis-ci.org/angular-ui/ui-router.svg?branch=master)](https://travis-ci.org/angular-ui/ui-router)
[![Greenkeeper badge](https://badges.greenkeeper.io/angular-ui/ui-router.svg)](https://greenkeeper.io/)
**Note: this is the Angular 1.x source for UI-Router version 1.0. If you are looking for the source for UI-Router
version 0.2.x, it can be found [here](https://github.com/angular-ui/ui-router/tree/legacy)**
---
#### The de-facto solution to flexible routing in angular
---
**[Tutorials](https://ui-router.github.io/tutorials/)** |
**[API Docs](https://ui-router.github.io/docs/latest/)** |
**[Download stable](http://unpkg.com/@uirouter/angularjs@latest/release/angular-ui-router.js)** (or **[Minified](http://unpkg.com/@uirouter/angularjs@latest/release/angular-ui-router.min.js)**) **|**
**[Guide](https://github.com/angular-ui/ui-router/wiki) |**
**[Sample App](http://ui-router.github.io/resources/sampleapp/) |**
**[FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions) |**
**[Report an Issue](https://github.com/angular-ui/ui-router/blob/master/CONTRIBUTING.md#report-an-issue) |**
**[Contribute](https://github.com/angular-ui/ui-router/blob/master/CONTRIBUTING.md#contribute) |**
**[Help!](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) |**
---
Angular UI-Router is a client-side [Single Page Application](https://en.wikipedia.org/wiki/Single-page_application)
routing framework for [AngularJS](http://angularjs.org).
Routing frameworks for SPAs update the browser's URL as the user navigates through the app. Conversely, this allows
changes to the browser's URL to drive navigation through the app, thus allowing the user to create a bookmark to a
location deep within the SPA.
UI-Router applications are modeled as a hierarchical tree of states. UI-Router provides a
[*state machine*](https://en.wikipedia.org/wiki/Finite-state_machine) to manage the transitions between those
application states in a transaction-like manner.
## Get Started
- [UI-Router for Angular 1](https://ui-router.github.io/ng1)
- [UI-Router for Angular 2](https://ui-router.github.io/ng2)
- [UI-Router for React](https://ui-router.github.io/react)
## Resources
* [In-Depth Guide](https://github.com/angular-ui/ui-router/wiki)
* [Slides comparing ngRoute to ui-router](http://slid.es/timkindberg/ui-router#/)
* [UI-Router Extras / Addons for legacy (0.x)](http://christopherthielen.github.io/ui-router-extras/#/home) (@christopherthielen)
### Videos
* [Introduction Video](https://egghead.io/lessons/angularjs-introduction-ui-router) (egghead.io)
* [Tim Kindberg on Angular UI-Router](https://www.youtube.com/watch?v=lBqiZSemrqg)
* [Activating States](https://egghead.io/lessons/angularjs-ui-router-activating-states) (egghead.io)
* [Learn Angular.js using UI-Router](http://youtu.be/QETUuZ27N0w) (LearnCode.academy)
## Reporting issues and Contributing
Please read our [Contributor guidelines](CONTRIBUTING.md) before reporting an issue or creating a pull request.
{
"ARTIFACTS": ["lib", "lib-esm", "release", "package.json"]
}
{
"sample-app-angularjs": "https://github.com/ui-router/sample-app-angularjs.git",
"typescript2.2": "./test/typescript2.2",
"typescript2.3": "./test/typescript2.3",
"typescript2.4": "./test/typescript2.4",
"typescript2.5": "./test/typescript2.5",
"typescript2.6": "./test/typescript2.6"
}
/** @hidden */ export declare const ng: any;
/** @publicapi @module ng1 */ /** */
import * as ng_from_import from 'angular';
/** @hidden */ var ng_from_global = angular;
/** @hidden */ export var ng = ng_from_import && ng_from_import.module ? ng_from_import : ng_from_global;
//# sourceMappingURL=angular.js.map
\ No newline at end of file
{
"version": 3,
"file": "angular.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/angular.ts"
],
"names": [],
"mappings": "AAAA,6BAA6B,CAAC,MAAM;AACpC,OAAO,KAAK,cAAc,MAAM,SAAS,CAAC;AAE1C,cAAc,CAAC,IAAM,cAAc,GAAG,OAAO,CAAC;AAC9C,cAAc,CAAC,MAAM,CAAC,IAAM,EAAE,GAAG,cAAc,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\nimport * as ng_from_import from 'angular';\n/** @hidden */ declare var angular;\n/** @hidden */ const ng_from_global = angular;\n/** @hidden */ export const ng = ng_from_import && ng_from_import.module ? ng_from_import : ng_from_global;\n"
]
}
\ No newline at end of file
/** @hidden Used for typedoc */
export interface ng1_directive {
}
...@@ -469,10 +469,10 @@ uiStateDirective = [ ...@@ -469,10 +469,10 @@ uiStateDirective = [
* the specified state names/globs, even the abstract ones. * the specified state names/globs, even the abstract ones.
* *
* #### Example: * #### Example:
* Given the following template, with "admin" being an abstract state: * Given the following template, with "common" being an abstract state:
* ```html * ```html
* <div ui-sref-active="{'active': 'admin.**'}"> * <div ui-sref-active="{'active': 'common.**'}">
* <a ui-sref-active="active" ui-sref="admin.roles">Roles</a> * <a ui-sref-active="active" ui-sref="common.roles">Roles</a>
* </div> * </div>
* ``` * ```
* *
...@@ -480,14 +480,14 @@ uiStateDirective = [ ...@@ -480,14 +480,14 @@ uiStateDirective = [
* This allows multiple states to add `active` class. * This allows multiple states to add `active` class.
* *
* #### Example: * #### Example:
* Given the following template, with "admin.roles" being the current state, the class will be added too: * Given the following template, with "common.roles" being the current state, the class will be added too:
* ```html * ```html
* <div ui-sref-active="{'active': ['owner.**', 'admin.**']}"> * <div ui-sref-active="{'active': ['owner.**', 'common.**']}">
* <a ui-sref-active="active" ui-sref="admin.roles">Roles</a> * <a ui-sref-active="active" ui-sref="common.roles">Roles</a>
* </div> * </div>
* ``` * ```
* *
* When the current state is "admin.roles" the "active" class will be applied to both the `<div>` and `<a>` elements. * When the current state is "common.roles" the "active" class will be applied to both the `<div>` and `<a>` elements.
* It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`. * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.
* *
* ### Notes: * ### Notes:
......
/** @publicapi @module directives */ /** */
import { ActiveUIView } from '@uirouter/core';
import { Ng1ViewConfig } from '../statebuilders/views';
import { ng1_directive } from './stateDirectives';
/** @hidden */
export declare type UIViewData = {
$cfg: Ng1ViewConfig;
$uiView: ActiveUIView;
};
/** @hidden */
export declare type UIViewAnimData = {
$animEnter: Promise<any>;
$animLeave: Promise<any>;
$$animLeave: {
resolve: () => any;
};
};
/**
* `ui-view`: A viewport directive which is filled in by a view from the active state.
*
* ### Attributes
*
* - `name`: (Optional) A view name.
* The name should be unique amongst the other views in the same state.
* You can have views of the same name that live in different states.
* The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).
*
* - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.
* Uses [[$uiViewScroll]] to do the scrolling.
*
* - `onload`: Expression to evaluate whenever the view updates.
*
* #### Example:
* A view can be unnamed or named.
* ```html
* <!-- Unnamed -->
* <div ui-view></div>
*
* <!-- Named -->
* <div ui-view="viewName"></div>
*
* <!-- Named (different style) -->
* <ui-view name="viewName"></ui-view>
* ```
*
* You can only have one unnamed view within any template (or root html). If you are only using a
* single view and it is unnamed then you can populate it like so:
*
* ```html
* <div ui-view></div>
* $stateProvider.state("home", {
* template: "<h1>HELLO!</h1>"
* })
* ```
*
* The above is a convenient shortcut equivalent to specifying your view explicitly with the
* [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:
*
* ```js
* $stateProvider.state("home", {
* views: {
* "": {
* template: "<h1>HELLO!</h1>"
* }
* }
* })
* ```
*
* But typically you'll only use the views property if you name your view or have more than one view
* in the same template. There's not really a compelling reason to name a view if its the only one,
* but you could if you wanted, like so:
*
* ```html
* <div ui-view="main"></div>
* ```
*
* ```js
* $stateProvider.state("home", {
* views: {
* "main": {
* template: "<h1>HELLO!</h1>"
* }
* }
* })
* ```
*
* Really though, you'll use views to set up multiple views:
*
* ```html
* <div ui-view></div>
* <div ui-view="chart"></div>
* <div ui-view="data"></div>
* ```
*
* ```js
* $stateProvider.state("home", {
* views: {
* "": {
* template: "<h1>HELLO!</h1>"
* },
* "chart": {
* template: "<chart_thing/>"
* },
* "data": {
* template: "<data_thing/>"
* }
* }
* })
* ```
*
* #### Examples for `autoscroll`:
* ```html
* <!-- If autoscroll present with no expression,
* then scroll ui-view into view -->
* <ui-view autoscroll/>
*
* <!-- If autoscroll present with valid expression,
* then scroll ui-view into view if expression evaluates to true -->
* <ui-view autoscroll='true'/>
* <ui-view autoscroll='false'/>
* <ui-view autoscroll='scopeVariable'/>
* ```
*
* Resolve data:
*
* The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this
* can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.
*
* Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the
* controller is instantiated. The `$onInit()` hook can be used to perform initialization code which
* depends on `$resolve` data.
*
* #### Example:
* ```js
* $stateProvider.state('home', {
* template: '<my-component user="$resolve.user"></my-component>',
* resolve: {
* user: function(UserService) { return UserService.fetchUser(); }
* }
* });
* ```
*/
export declare let uiView: ng1_directive;
/**
* Main entry point for angular 1.x build
* @publicapi @module ng1
*/ /** */
export * from './interface';
export * from './services';
export * from './statebuilders/views';
export * from './stateProvider';
export * from './urlRouterProvider';
import './injectables';
import './directives/stateDirectives';
import './stateFilters';
import './directives/viewDirective';
import './viewScroll';
declare const _default: "ui.router";
export default _default;
import * as core from '@uirouter/core';
export { core };
export * from '@uirouter/core';
export * from './services';
export * from './statebuilders/views';
export * from './stateProvider';
export * from './urlRouterProvider';
import './injectables';
import './directives/stateDirectives';
import './stateFilters';
import './directives/viewDirective';
import './viewScroll';
export default 'ui.router';
import * as core from '@uirouter/core';
export { core };
export * from '@uirouter/core';
//# sourceMappingURL=index.js.map
\ No newline at end of file
{
"version": 3,
"file": "index.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/index.ts"
],
"names": [],
"mappings": "AAKA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AAEpC,OAAO,eAAe,CAAC;AACvB,OAAO,8BAA8B,CAAC;AACtC,OAAO,gBAAgB,CAAC;AACxB,OAAO,4BAA4B,CAAC;AACpC,OAAO,cAAc,CAAC;AAEtB,eAAe,WAAW,CAAC;AAE3B,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,cAAc,gBAAgB,CAAC",
"sourcesContent": [
"/**\n * Main entry point for angular 1.x build\n * @publicapi @module ng1\n */ /** */\nexport * from './interface';\nexport * from './services';\nexport * from './statebuilders/views';\nexport * from './stateProvider';\nexport * from './urlRouterProvider';\n\nimport './injectables';\nimport './directives/stateDirectives';\nimport './stateFilters';\nimport './directives/viewDirective';\nimport './viewScroll';\n\nexport default 'ui.router';\n\nimport * as core from '@uirouter/core';\nexport { core };\nexport * from '@uirouter/core';\n"
]
}
\ No newline at end of file
//# sourceMappingURL=interface.js.map
\ No newline at end of file
/** @hidden */
export declare const resolveFactory: () => {
/**
* Asynchronously injects a resolve block.
*
* This emulates most of the behavior of the ui-router 0.2.x $resolve.resolve() service API.
*
* ### Not bundled by default
*
* This API is no longer not part of the standard `@uirouter/angularjs` bundle.
* For users of the prebuilt bundles, add the `release/resolveService.min.js` UMD bundle.
* For bundlers (webpack, browserify, etc), add `@uirouter/angularjs/lib/legacy/resolveService`.
*
* ---
*
* Given an object `invocables`, where keys are strings and values are injectable functions,
* injects each function, and waits for the resulting promise to resolve.
* When all resulting promises are resolved, returns the results as an object.
*
* #### Example:
* ```js
* let invocables = {
* foo: [ '$http', ($http) =>
* $http.get('/api/foo').then(resp => resp.data) ],
* bar: [ 'foo', '$http', (foo, $http) =>
* $http.get('/api/bar/' + foo.barId).then(resp => resp.data) ]
* }
* $resolve.resolve(invocables)
* .then(results => console.log(results.foo, results.bar))
* // Logs foo and bar:
* // { id: 123, barId: 456, fooData: 'foo data' }
* // { id: 456, barData: 'bar data' }
* ```
*
* @param invocables an object which looks like an [[StateDeclaration.resolve]] object; keys are resolve names and values are injectable functions
* @param locals key/value pre-resolved data (locals)
* @param parent a promise for a "parent resolve"
*/
resolve: (invocables: {
[key: string]: Function;
}, locals?: {}, parent?: Promise<any>) => Promise<{}>;
};
/** @publicapi @module ng1 */ /** */
import { StateObject, PathNode, ResolveContext, mapObj, resolvablesBuilder } from '@uirouter/core';
import * as angular from 'angular';
/**
* Implementation of the legacy `$resolve` service for angular 1.
*/
var $resolve = {
/**
* Asynchronously injects a resolve block.
*
* This emulates most of the behavior of the ui-router 0.2.x $resolve.resolve() service API.
*
* ### Not bundled by default
*
* This API is no longer not part of the standard `@uirouter/angularjs` bundle.
* For users of the prebuilt bundles, add the `release/resolveService.min.js` UMD bundle.
* For bundlers (webpack, browserify, etc), add `@uirouter/angularjs/lib/legacy/resolveService`.
*
* ---
*
* Given an object `invocables`, where keys are strings and values are injectable functions,
* injects each function, and waits for the resulting promise to resolve.
* When all resulting promises are resolved, returns the results as an object.
*
* #### Example:
* ```js
* let invocables = {
* foo: [ '$http', ($http) =>
* $http.get('/api/foo').then(resp => resp.data) ],
* bar: [ 'foo', '$http', (foo, $http) =>
* $http.get('/api/bar/' + foo.barId).then(resp => resp.data) ]
* }
* $resolve.resolve(invocables)
* .then(results => console.log(results.foo, results.bar))
* // Logs foo and bar:
* // { id: 123, barId: 456, fooData: 'foo data' }
* // { id: 456, barData: 'bar data' }
* ```
*
* @param invocables an object which looks like an [[StateDeclaration.resolve]] object; keys are resolve names and values are injectable functions
* @param locals key/value pre-resolved data (locals)
* @param parent a promise for a "parent resolve"
*/
resolve: function (invocables, locals, parent) {
if (locals === void 0) { locals = {}; }
var parentNode = new PathNode(new StateObject({ params: {}, resolvables: [] }));
var node = new PathNode(new StateObject({ params: {}, resolvables: [] }));
var context = new ResolveContext([parentNode, node]);
context.addResolvables(resolvablesBuilder({ resolve: invocables }), node.state);
var resolveData = function (parentLocals) {
var rewrap = function (_locals) { return resolvablesBuilder({ resolve: mapObj(_locals, function (local) { return function () { return local; }; }) }); };
context.addResolvables(rewrap(parentLocals), parentNode.state);
context.addResolvables(rewrap(locals), node.state);
var tuples2ObjR = function (acc, tuple) {
acc[tuple.token] = tuple.value;
return acc;
};
return context.resolvePath().then(function (results) { return results.reduce(tuples2ObjR, {}); });
};
return parent ? parent.then(resolveData) : resolveData({});
},
};
/** @hidden */
export var resolveFactory = function () { return $resolve; };
// The old $resolve service
angular.module('ui.router').factory('$resolve', resolveFactory);
//# sourceMappingURL=resolveService.js.map
\ No newline at end of file
{
"version": 3,
"file": "resolveService.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/legacy/resolveService.ts"
],
"names": [],
"mappings": "AAAA,6BAA6B,CAAC,MAAM;AACpC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAO,MAAM,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACxG,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC;;GAEG;AACH,IAAM,QAAQ,GAAG;IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,OAAO,EAAE,UAAC,UAAuC,EAAE,MAAW,EAAE,MAAqB;QAAlC,uBAAA,EAAA,WAAW;QAC5D,IAAM,UAAU,GAAG,IAAI,QAAQ,CAAC,IAAI,WAAW,CAAM,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACvF,IAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,WAAW,CAAM,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACjF,IAAM,OAAO,GAAG,IAAI,cAAc,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QAEvD,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAErF,IAAM,WAAW,GAAG,UAAC,YAAiB;YACpC,IAAM,MAAM,GAAG,UAAC,OAAY,IAAK,OAAA,kBAAkB,CAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,UAAA,KAAK,IAAI,OAAA,cAAM,OAAA,KAAK,EAAL,CAAK,EAAX,CAAW,CAAC,EAAE,CAAC,EAA3E,CAA2E,CAAC;YAC7G,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;YAC/D,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAEnD,IAAM,WAAW,GAAG,UAAC,GAAQ,EAAE,KAAiC;gBAC9D,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;gBAC/B,OAAO,GAAG,CAAC;YACb,CAAC,CAAC;YACF,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,EAA/B,CAA+B,CAAC,CAAC;QAChF,CAAC,CAAC;QAEF,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC7D,CAAC;CACF,CAAC;AAEF,cAAc;AACd,MAAM,CAAC,IAAM,cAAc,GAAG,cAAM,OAAA,QAAQ,EAAR,CAAQ,CAAC;AAE7C,2BAA2B;AAC3B,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,UAAU,EAAO,cAAc,CAAC,CAAC",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\nimport { StateObject, PathNode, ResolveContext, Obj, mapObj, resolvablesBuilder } from '@uirouter/core';\nimport * as angular from 'angular';\n\n/**\n * Implementation of the legacy `$resolve` service for angular 1.\n */\nconst $resolve = {\n /**\n * Asynchronously injects a resolve block.\n *\n * This emulates most of the behavior of the ui-router 0.2.x $resolve.resolve() service API.\n *\n * ### Not bundled by default\n *\n * This API is no longer not part of the standard `@uirouter/angularjs` bundle.\n * For users of the prebuilt bundles, add the `release/resolveService.min.js` UMD bundle.\n * For bundlers (webpack, browserify, etc), add `@uirouter/angularjs/lib/legacy/resolveService`.\n *\n * ---\n *\n * Given an object `invocables`, where keys are strings and values are injectable functions,\n * injects each function, and waits for the resulting promise to resolve.\n * When all resulting promises are resolved, returns the results as an object.\n *\n * #### Example:\n * ```js\n * let invocables = {\n * foo: [ '$http', ($http) =>\n * $http.get('/api/foo').then(resp => resp.data) ],\n * bar: [ 'foo', '$http', (foo, $http) =>\n * $http.get('/api/bar/' + foo.barId).then(resp => resp.data) ]\n * }\n * $resolve.resolve(invocables)\n * .then(results => console.log(results.foo, results.bar))\n * // Logs foo and bar:\n * // { id: 123, barId: 456, fooData: 'foo data' }\n * // { id: 456, barData: 'bar data' }\n * ```\n *\n * @param invocables an object which looks like an [[StateDeclaration.resolve]] object; keys are resolve names and values are injectable functions\n * @param locals key/value pre-resolved data (locals)\n * @param parent a promise for a \"parent resolve\"\n */\n resolve: (invocables: { [key: string]: Function }, locals = {}, parent?: Promise<any>) => {\n const parentNode = new PathNode(new StateObject(<any>{ params: {}, resolvables: [] }));\n const node = new PathNode(new StateObject(<any>{ params: {}, resolvables: [] }));\n const context = new ResolveContext([parentNode, node]);\n\n context.addResolvables(resolvablesBuilder(<any>{ resolve: invocables }), node.state);\n\n const resolveData = (parentLocals: Obj) => {\n const rewrap = (_locals: Obj) => resolvablesBuilder(<any>{ resolve: mapObj(_locals, local => () => local) });\n context.addResolvables(rewrap(parentLocals), parentNode.state);\n context.addResolvables(rewrap(locals), node.state);\n\n const tuples2ObjR = (acc: Obj, tuple: { token: any; value: any }) => {\n acc[tuple.token] = tuple.value;\n return acc;\n };\n return context.resolvePath().then(results => results.reduce(tuples2ObjR, {}));\n };\n\n return parent ? parent.then(resolveData) : resolveData({});\n },\n};\n\n/** @hidden */\nexport const resolveFactory = () => $resolve;\n\n// The old $resolve service\nangular.module('ui.router').factory('$resolve', <any>resolveFactory);\n"
]
}
\ No newline at end of file
import { IAngularEvent } from 'angular';
/**
* An event broadcast on `$rootScope` when the state transition **begins**.
*
* ### Deprecation warning: use [[TransitionService.onStart]] instead
*
* You can use `event.preventDefault()`
* to prevent the transition from happening and then the transition promise will be
* rejected with a `'transition prevented'` value.
*
* Additional arguments to the event handler are provided:
* - `toState`: the Transition Target state
* - `toParams`: the Transition Target Params
* - `fromState`: the state the transition is coming from
* - `fromParams`: the parameters from the state the transition is coming from
* - `options`: any Transition Options
* - `$transition$`: the [[Transition]]
*
* #### Example:
* ```js
* $rootScope.$on('$stateChangeStart', function(event, transition) {
* event.preventDefault();
* // transitionTo() promise will be rejected with
* // a 'transition prevented' error
* })
* ```
*
* @event $stateChangeStart
* @deprecated
*/
export declare let $stateChangeStart: IAngularEvent;
/**
* An event broadcast on `$rootScope` if a transition is **cancelled**.
*
* ### Deprecation warning: use [[TransitionService.onStart]] instead
*
* Additional arguments to the event handler are provided:
* - `toState`: the Transition Target state
* - `toParams`: the Transition Target Params
* - `fromState`: the state the transition is coming from
* - `fromParams`: the parameters from the state the transition is coming from
* - `options`: any Transition Options
* - `$transition$`: the [[Transition]] that was cancelled
*
* @event $stateChangeCancel
* @deprecated
*/
export declare let $stateChangeCancel: IAngularEvent;
/**
* An event broadcast on `$rootScope` once the state transition is **complete**.
*
* ### Deprecation warning: use [[TransitionService.onStart]] and [[Transition.promise]], or [[Transition.onSuccess]]
*
* Additional arguments to the event handler are provided:
* - `toState`: the Transition Target state
* - `toParams`: the Transition Target Params
* - `fromState`: the state the transition is coming from
* - `fromParams`: the parameters from the state the transition is coming from
* - `options`: any Transition Options
* - `$transition$`: the [[Transition]] that just succeeded
*
* @event $stateChangeSuccess
* @deprecated
*/
export declare let $stateChangeSuccess: IAngularEvent;
/**
* An event broadcast on `$rootScope` when an **error occurs** during transition.
*
* ### Deprecation warning: use [[TransitionService.onStart]] and [[Transition.promise]], or [[Transition.onError]]
*
* It's important to note that if you
* have any errors in your resolve functions (javascript errors, non-existent services, etc)
* they will not throw traditionally. You must listen for this $stateChangeError event to
* catch **ALL** errors.
*
* Additional arguments to the event handler are provided:
* - `toState`: the Transition Target state
* - `toParams`: the Transition Target Params
* - `fromState`: the state the transition is coming from
* - `fromParams`: the parameters from the state the transition is coming from
* - `error`: The reason the transition errored.
* - `options`: any Transition Options
* - `$transition$`: the [[Transition]] that errored
*
* @event $stateChangeError
* @deprecated
*/
export declare let $stateChangeError: IAngularEvent;
/**
* An event broadcast on `$rootScope` when a requested state **cannot be found** using the provided state name.
*
* ### Deprecation warning: use [[StateService.onInvalid]] instead
*
* The event is broadcast allowing any handlers a single chance to deal with the error (usually by
* lazy-loading the unfound state). A `TargetState` object is passed to the listener handler,
* you can see its properties in the example. You can use `event.preventDefault()` to abort the
* transition and the promise returned from `transitionTo()` will be rejected with a
* `'transition aborted'` error.
*
* Additional arguments to the event handler are provided:
* - `unfoundState` Unfound State information. Contains: `to, toParams, options` properties.
* - `fromState`: the state the transition is coming from
* - `fromParams`: the parameters from the state the transition is coming from
* - `options`: any Transition Options
*
* #### Example:
* ```js
* // somewhere, assume lazy.state has not been defined
* $state.go("lazy.state", { a: 1, b: 2 }, { inherit: false });
*
* // somewhere else
* $scope.$on('$stateNotFound', function(event, transition) {
* function(event, unfoundState, fromState, fromParams){
* console.log(unfoundState.to); // "lazy.state"
* console.log(unfoundState.toParams); // {a:1, b:2}
* console.log(unfoundState.options); // {inherit:false} + default options
* });
* ```
*
* @event $stateNotFound
* @deprecated
*/
export declare let $stateNotFound: IAngularEvent;
/** @publicapi @module ng1 */ /** */
import { LocationConfig, LocationServices, UIRouter } from '@uirouter/core';
import { ILocationService, ILocationProvider, IWindowService } from 'angular';
/**
* Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service
* @internalapi
*/
export declare class Ng1LocationServices implements LocationConfig, LocationServices {
private $locationProvider;
private $location;
private $sniffer;
private $browser;
private $window;
path: any;
search: any;
hash: any;
hashPrefix: any;
port: any;
protocol: any;
host: any;
private _baseHref;
private _urlListeners;
/**
* Applys ng1-specific path parameter encoding
*
* The Angular 1 `$location` service is a bit weird.
* It doesn't allow slashes to be encoded/decoded bi-directionally.
*
* See the writeup at https://github.com/angular-ui/ui-router/issues/2598
*
* This code patches the `path` parameter type so it encoded/decodes slashes as ~2F
*
* @param router
*/
static monkeyPatchPathParameterType(router: UIRouter): void;
dispose(): void;
constructor($locationProvider: ILocationProvider);
onChange(callback: Function): () => Function[];
html5Mode(): any;
baseHref(): any;
url(newUrl?: string, replace?: boolean, state?: any): string;
_runtimeServices($rootScope: any, $location: ILocationService, $sniffer: any, $browser: any, $window: IWindowService): void;
}
/** @publicapi @module ng1 */ /** */
import { isDefined } from '@uirouter/core';
import { val, createProxyFunctions, removeFrom, isObject } from '@uirouter/core';
/**
* Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service
* @internalapi
*/
var Ng1LocationServices = /** @class */ (function () {
function Ng1LocationServices($locationProvider) {
// .onChange() registry
this._urlListeners = [];
this.$locationProvider = $locationProvider;
var _lp = val($locationProvider);
createProxyFunctions(_lp, this, _lp, ['hashPrefix']);
}
/**
* Applys ng1-specific path parameter encoding
*
* The Angular 1 `$location` service is a bit weird.
* It doesn't allow slashes to be encoded/decoded bi-directionally.
*
* See the writeup at https://github.com/angular-ui/ui-router/issues/2598
*
* This code patches the `path` parameter type so it encoded/decodes slashes as ~2F
*
* @param router
*/
Ng1LocationServices.monkeyPatchPathParameterType = function (router) {
var pathType = router.urlMatcherFactory.type('path');
pathType.encode = function (x) {
return x != null ? x.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : x;
};
pathType.decode = function (x) {
return x != null ? x.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : x;
};
};
Ng1LocationServices.prototype.dispose = function () { };
Ng1LocationServices.prototype.onChange = function (callback) {
var _this = this;
this._urlListeners.push(callback);
return function () { return removeFrom(_this._urlListeners)(callback); };
};
Ng1LocationServices.prototype.html5Mode = function () {
var html5Mode = this.$locationProvider.html5Mode();
html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;
return html5Mode && this.$sniffer.history;
};
Ng1LocationServices.prototype.baseHref = function () {
return this._baseHref || (this._baseHref = this.$browser.baseHref() || this.$window.location.pathname);
};
Ng1LocationServices.prototype.url = function (newUrl, replace, state) {
if (replace === void 0) { replace = false; }
if (isDefined(newUrl))
this.$location.url(newUrl);
if (replace)
this.$location.replace();
if (state)
this.$location.state(state);
return this.$location.url();
};
Ng1LocationServices.prototype._runtimeServices = function ($rootScope, $location, $sniffer, $browser, $window) {
var _this = this;
this.$location = $location;
this.$sniffer = $sniffer;
this.$browser = $browser;
this.$window = $window;
// Bind $locationChangeSuccess to the listeners registered in LocationService.onChange
$rootScope.$on('$locationChangeSuccess', function (evt) { return _this._urlListeners.forEach(function (fn) { return fn(evt); }); });
var _loc = val($location);
// Bind these LocationService functions to $location
createProxyFunctions(_loc, this, _loc, ['replace', 'path', 'search', 'hash']);
// Bind these LocationConfig functions to $location
createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);
};
return Ng1LocationServices;
}());
export { Ng1LocationServices };
//# sourceMappingURL=locationServices.js.map
\ No newline at end of file
{
"version": 3,
"file": "locationServices.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/locationServices.ts"
],
"names": [],
"mappings": "AAAA,6BAA6B,CAAC,MAAM;AACpC,OAAO,EAAyD,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAGjF;;;GAGG;AACH;IA4CE,6BAAY,iBAAoC;QA3BhD,uBAAuB;QACf,kBAAa,GAAe,EAAE,CAAC;QA2BrC,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAM,GAAG,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACnC,oBAAoB,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,YA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SAAS,CAAC,CAAC;QAE5B,oDAAoD;QACpD,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9E,mDAAmD;QACnD,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;IACH,0BAAC;AAAD,CAAC,AAvFD,IAuFC",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType, isDefined } from '@uirouter/core';\nimport { val, createProxyFunctions, removeFrom, isObject } from '@uirouter/core';\nimport { ILocationService, ILocationProvider, IWindowService } from 'angular';\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n * @internalapi\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n private $locationProvider: ILocationProvider;\n private $location: ILocationService;\n private $sniffer: any;\n private $browser: any;\n private $window: IWindowService;\n\n path;\n search;\n hash;\n hashPrefix;\n port;\n protocol;\n host;\n\n private _baseHref: string;\n\n // .onChange() registry\n private _urlListeners: Function[] = [];\n\n /**\n * Applys ng1-specific path parameter encoding\n *\n * The Angular 1 `$location` service is a bit weird.\n * It doesn't allow slashes to be encoded/decoded bi-directionally.\n *\n * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n *\n * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n *\n * @param router\n */\n static monkeyPatchPathParameterType(router: UIRouter) {\n const pathType: ParamType = router.urlMatcherFactory.type('path');\n\n pathType.encode = (x: any) =>\n x != null ? x.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : x;\n\n pathType.decode = (x: string) =>\n x != null ? x.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : x;\n }\n\n dispose() {}\n\n constructor($locationProvider: ILocationProvider) {\n this.$locationProvider = $locationProvider;\n const _lp = val($locationProvider);\n createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n }\n\n onChange(callback: Function) {\n this._urlListeners.push(callback);\n return () => removeFrom(this._urlListeners)(callback);\n }\n\n html5Mode() {\n let html5Mode: any = this.$locationProvider.html5Mode();\n html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n return html5Mode && this.$sniffer.history;\n }\n\n baseHref() {\n return this._baseHref || (this._baseHref = this.$browser.baseHref() || this.$window.location.pathname);\n }\n\n url(newUrl?: string, replace = false, state?) {\n if (isDefined(newUrl)) this.$location.url(newUrl);\n if (replace) this.$location.replace();\n if (state) this.$location.state(state);\n return this.$location.url();\n }\n\n _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser, $window: IWindowService) {\n this.$location = $location;\n this.$sniffer = $sniffer;\n this.$browser = $browser;\n this.$window = $window;\n\n // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n $rootScope.$on('$locationChangeSuccess', evt => this._urlListeners.forEach(fn => fn(evt)));\n const _loc = val($location);\n\n // Bind these LocationService functions to $location\n createProxyFunctions(_loc, this, _loc, ['replace', 'path', 'search', 'hash']);\n // Bind these LocationConfig functions to $location\n createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n }\n}\n"
]
}
\ No newline at end of file
import { IRootScopeService } from 'angular';
import { ResolveContext, TypedMap } from '@uirouter/core';
import { StateProvider } from './stateProvider';
import { UrlRouterProvider } from './urlRouterProvider';
declare module '@uirouter/core/lib/router' {
interface UIRouter {
/** @hidden */
stateProvider: StateProvider;
/** @hidden */
urlRouterProvider: UrlRouterProvider;
}
}
export declare function watchDigests($rootScope: IRootScopeService): void;
export declare namespace watchDigests {
var $inject: string[];
}
/** @hidden TODO: find a place to move this */
export declare const getLocals: (ctx: ResolveContext) => TypedMap<any>;
/**
* # Angular 1 types
*
* UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.
* The customizations to the core types for Angular UI-Router are documented here.
*
* The optional [[$resolve]] service is also documented here.
*
* @preferred @publicapi @module ng1
*/ /** */
import { ng as angular } from './angular';
import { services, applyPairs, isString, trace, extend, UIRouter, unnestR, } from '@uirouter/core';
import { ng1ViewsBuilder, getNg1ViewConfigFactory } from './statebuilders/views';
import { TemplateFactory } from './templateFactory';
import { StateProvider } from './stateProvider';
import { getStateHookBuilder } from './statebuilders/onEnterExitRetain';
import { Ng1LocationServices } from './locationServices';
import { UrlRouterProvider } from './urlRouterProvider';
angular.module('ui.router.angular1', []);
var mod_init = angular.module('ui.router.init', ['ng']);
var mod_util = angular.module('ui.router.util', ['ui.router.init']);
var mod_rtr = angular.module('ui.router.router', ['ui.router.util']);
var mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);
var mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);
var mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line
var router = null;
$uiRouterProvider.$inject = ['$locationProvider'];
/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */
function $uiRouterProvider($locationProvider) {
// Create a new instance of the Router when the $uiRouterProvider is initialized
router = this.router = new UIRouter();
router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);
// Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties
router.stateRegistry.decorator('views', ng1ViewsBuilder);
router.stateRegistry.decorator('onExit', getStateHookBuilder('onExit'));
router.stateRegistry.decorator('onRetain', getStateHookBuilder('onRetain'));
router.stateRegistry.decorator('onEnter', getStateHookBuilder('onEnter'));
router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());
var ng1LocationService = (router.locationService = router.locationConfig = new Ng1LocationServices($locationProvider));
Ng1LocationServices.monkeyPatchPathParameterType(router);
// backwards compat: also expose router instance as $uiRouterProvider.router
router['router'] = router;
router['$get'] = $get;
$get.$inject = ['$location', '$browser', '$window', '$sniffer', '$rootScope', '$http', '$templateCache'];
function $get($location, $browser, $window, $sniffer, $rootScope, $http, $templateCache) {
ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser, $window);
delete router['router'];
delete router['$get'];
return router;
}
return router;
}
var getProviderFor = function (serviceName) { return [
'$uiRouterProvider',
function ($urp) {
var service = $urp.router[serviceName];
service['$get'] = function () { return service; };
return service;
},
]; };
// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)
runBlock.$inject = ['$injector', '$q', '$uiRouter'];
function runBlock($injector, $q, $uiRouter) {
services.$injector = $injector;
services.$q = $q;
// https://github.com/angular-ui/ui-router/issues/3678
if (!$injector.hasOwnProperty('strictDi')) {
try {
$injector.invoke(function (checkStrictDi) { });
}
catch (error) {
$injector.strictDi = !!/strict mode/.exec(error && error.toString());
}
}
// The $injector is now available.
// Find any resolvables that had dependency annotation deferred
$uiRouter.stateRegistry
.get()
.map(function (x) { return x.$$state().resolvables; })
.reduce(unnestR, [])
.filter(function (x) { return x.deps === 'deferred'; })
.forEach(function (resolvable) { return (resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi)); });
}
// $urlRouter service and $urlRouterProvider
var getUrlRouterProvider = function (uiRouter) { return (uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter)); };
// $state service and $stateProvider
// $urlRouter service and $urlRouterProvider
var getStateProvider = function () { return extend(router.stateProvider, { $get: function () { return router.stateService; } }); };
watchDigests.$inject = ['$rootScope'];
export function watchDigests($rootScope) {
$rootScope.$watch(function () {
trace.approximateDigests++;
});
}
mod_init.provider('$uiRouter', $uiRouterProvider);
mod_rtr.provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);
mod_util.provider('$urlService', getProviderFor('urlService'));
mod_util.provider('$urlMatcherFactory', ['$uiRouterProvider', function () { return router.urlMatcherFactory; }]);
mod_util.provider('$templateFactory', function () { return new TemplateFactory(); });
mod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));
mod_state.provider('$uiRouterGlobals', getProviderFor('globals'));
mod_state.provider('$transitions', getProviderFor('transitionService'));
mod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);
mod_state.factory('$stateParams', ['$uiRouter', function ($uiRouter) { return $uiRouter.globals.params; }]);
mod_main.factory('$view', function () { return router.viewService; });
mod_main.service('$trace', function () { return trace; });
mod_main.run(watchDigests);
mod_util.run(['$urlMatcherFactory', function ($urlMatcherFactory) { }]);
mod_state.run(['$state', function ($state) { }]);
mod_rtr.run(['$urlRouter', function ($urlRouter) { }]);
mod_init.run(runBlock);
/** @hidden TODO: find a place to move this */
export var getLocals = function (ctx) {
var tokens = ctx.getTokens().filter(isString);
var tuples = tokens.map(function (key) {
var resolvable = ctx.getResolvable(key);
var waitPolicy = ctx.getPolicy(resolvable).async;
return [key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data];
});
return tuples.reduce(applyPairs, {});
};
//# sourceMappingURL=services.js.map
\ No newline at end of file
/** @publicapi @module ng1 */ /** */
import { StateService } from '@uirouter/core';
export declare function $IsStateFilter($state: StateService): any;
export declare namespace $IsStateFilter {
var $inject: string[];
}
export declare function $IncludedByStateFilter($state: StateService): any;
export declare namespace $IncludedByStateFilter {
var $inject: string[];
}
/** @publicapi @module ng1 */ /** */
import { ng as angular } from './angular';
/**
* `isState` Filter: truthy if the current state is the parameter
*
* Translates to [[StateService.is]] `$state.is("stateName")`.
*
* #### Example:
* ```html
* <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
* ```
*/
$IsStateFilter.$inject = ['$state'];
export function $IsStateFilter($state) {
var isFilter = function (state, params, options) {
return $state.is(state, params, options);
};
isFilter.$stateful = true;
return isFilter;
}
/**
* `includedByState` Filter: truthy if the current state includes the parameter
*
* Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`.
*
* #### Example:
* ```html
* <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
* ```
*/
$IncludedByStateFilter.$inject = ['$state'];
export function $IncludedByStateFilter($state) {
var includesFilter = function (state, params, options) {
return $state.includes(state, params, options);
};
includesFilter.$stateful = true;
return includesFilter;
}
angular
.module('ui.router.state')
.filter('isState', $IsStateFilter)
.filter('includedByState', $IncludedByStateFilter);
//# sourceMappingURL=stateFilters.js.map
\ No newline at end of file
{
"version": 3,
"file": "stateFilters.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/stateFilters.ts"
],
"names": [],
"mappings": "AAAA,6BAA6B,CAAC,MAAM;AAEpC,OAAO,EAAE,EAAE,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C;;;;;;;;;GASG;AACH,cAAc,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;AACpC,MAAM,UAAU,cAAc,CAAC,MAAoB;IACjD,IAAM,QAAQ,GAAQ,UAAS,KAAkB,EAAE,MAAW,EAAE,OAAoC;QAClG,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC,CAAC;IACF,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,sBAAsB,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC5C,MAAM,UAAU,sBAAsB,CAAC,MAAoB;IACzD,IAAM,cAAc,GAAQ,UAAS,KAAkB,EAAE,MAAW,EAAE,OAAmC;QACvG,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC,CAAC;IACF,cAAc,CAAC,SAAS,GAAG,IAAI,CAAC;IAChC,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,OAAO;KACJ,MAAM,CAAC,iBAAiB,CAAC;KACzB,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC;KACjC,MAAM,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\n\nimport { ng as angular } from './angular';\nimport { Obj, StateService, StateOrName } from '@uirouter/core';\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n * <div ng-if=\"'stateName' | isState\">show if state is 'stateName'</div>\n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n const isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n return $state.is(state, params, options);\n };\n isFilter.$stateful = true;\n return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n * <div ng-if=\"'fullOrPartialStateName' | includedByState\">show if state includes 'fullOrPartialStateName'</div>\n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n const includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n return $state.includes(state, params, options);\n };\n includesFilter.$stateful = true;\n return includesFilter;\n}\n\nangular\n .module('ui.router.state')\n .filter('isState', $IsStateFilter)\n .filter('includedByState', $IncludedByStateFilter);\n"
]
}
\ No newline at end of file
/** @publicapi @module ng1 */ /** */
import { val, isObject, createProxyFunctions, } from '@uirouter/core';
/**
* The Angular 1 `StateProvider`
*
* The `$stateProvider` works similar to Angular's v1 router, but it focuses purely
* on state.
*
* A state corresponds to a "place" in the application in terms of the overall UI and
* navigation. A state describes (via the controller / template / view properties) what
* the UI looks like and does at that place.
*
* States often have things in common, and the primary way of factoring out these
* commonalities in this model is via the state hierarchy, i.e. parent/child states aka
* nested states.
*
* The `$stateProvider` provides interfaces to declare these states for your app.
*/
var StateProvider = /** @class */ (function () {
function StateProvider(stateRegistry, stateService) {
this.stateRegistry = stateRegistry;
this.stateService = stateService;
createProxyFunctions(val(StateProvider.prototype), this, val(this));
}
/**
* Decorates states when they are registered
*
* Allows you to extend (carefully) or override (at your own peril) the
* `stateBuilder` object used internally by [[StateRegistry]].
* This can be used to add custom functionality to ui-router,
* for example inferring templateUrl based on the state name.
*
* When passing only a name, it returns the current (original or decorated) builder
* function that matches `name`.
*
* The builder functions that can be decorated are listed below. Though not all
* necessarily have a good use case for decoration, that is up to you to decide.
*
* In addition, users can attach custom decorators, which will generate new
* properties within the state's internal definition. There is currently no clear
* use-case for this beyond accessing internal states (i.e. $state.$current),
* however, expect this to become increasingly relevant as we introduce additional
* meta-programming features.
*
* **Warning**: Decorators should not be interdependent because the order of
* execution of the builder functions in non-deterministic. Builder functions
* should only be dependent on the state definition object and super function.
*
*
* Existing builder functions and current return values:
*
* - **parent** `{object}` - returns the parent state object.
* - **data** `{object}` - returns state data, including any inherited data that is not
* overridden by own values (if any).
* - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}
* or `null`.
* - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is
* navigable).
* - **params** `{object}` - returns an array of state params that are ensured to
* be a super-set of parent's params.
* - **views** `{object}` - returns a views object where each key is an absolute view
* name (i.e. "viewName@stateName") and each value is the config object
* (template, controller) for the view. Even when you don't use the views object
* explicitly on a state config, one is still created for you internally.
* So by decorating this builder function you have access to decorating template
* and controller properties.
* - **ownParams** `{object}` - returns an array of params that belong to the state,
* not including any params defined by ancestor states.
* - **path** `{string}` - returns the full path from the root down to this state.
* Needed for state activation.
* - **includes** `{object}` - returns an object that includes every state that
* would pass a `$state.includes()` test.
*
* #### Example:
* Override the internal 'views' builder with a function that takes the state
* definition, and a reference to the internal function being overridden:
* ```js
* $stateProvider.decorator('views', function (state, parent) {
* let result = {},
* views = parent(state);
*
* angular.forEach(views, function (config, name) {
* let autoName = (state.name + '.' + name).replace('.', '/');
* config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
* result[name] = config;
* });
* return result;
* });
*
* $stateProvider.state('home', {
* views: {
* 'contact.list': { controller: 'ListController' },
* 'contact.item': { controller: 'ItemController' }
* }
* });
* ```
*
*
* ```js
* // Auto-populates list and item views with /partials/home/contact/list.html,
* // and /partials/home/contact/item.html, respectively.
* $state.go('home');
* ```
*
* @param {string} name The name of the builder function to decorate.
* @param {object} func A function that is responsible for decorating the original
* builder function. The function receives two parameters:
*
* - `{object}` - state - The state config object.
* - `{object}` - super - The original builder function.
*
* @return {object} $stateProvider - $stateProvider instance
*/
StateProvider.prototype.decorator = function (name, func) {
return this.stateRegistry.decorator(name, func) || this;
};
StateProvider.prototype.state = function (name, definition) {
if (isObject(name)) {
definition = name;
}
else {
definition.name = name;
}
this.stateRegistry.register(definition);
return this;
};
/**
* Registers an invalid state handler
*
* This is a passthrough to [[StateService.onInvalid]] for ng1.
*/
StateProvider.prototype.onInvalid = function (callback) {
return this.stateService.onInvalid(callback);
};
return StateProvider;
}());
export { StateProvider };
//# sourceMappingURL=stateProvider.js.map
\ No newline at end of file
/** @publicapi @module ng1 */ /** */
import { StateObject, TransitionStateHookFn, BuilderFunction } from '@uirouter/core';
/**
* This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,
* `onRetain` callback hooks on a [[Ng1StateDeclaration]].
*
* When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder
* ensures that those hooks are injectable for @uirouter/angularjs (ng1).
*
* @internalapi
*/
export declare const getStateHookBuilder: (hookName: "onEnter" | "onExit" | "onRetain") => (stateObject: StateObject, parentFn: BuilderFunction) => TransitionStateHookFn;
/** @publicapi @module ng1 */ /** */
import { services, ResolveContext, extend, } from '@uirouter/core';
import { getLocals } from '../services';
/**
* This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,
* `onRetain` callback hooks on a [[Ng1StateDeclaration]].
*
* When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder
* ensures that those hooks are injectable for @uirouter/angularjs (ng1).
*
* @internalapi
*/
export var getStateHookBuilder = function (hookName) {
return function stateHookBuilder(stateObject, parentFn) {
var hook = stateObject[hookName];
var pathname = hookName === 'onExit' ? 'from' : 'to';
function decoratedNg1Hook(trans, state) {
var resolveContext = new ResolveContext(trans.treeChanges(pathname));
var subContext = resolveContext.subContext(state.$$state());
var locals = extend(getLocals(subContext), { $state$: state, $transition$: trans });
return services.$injector.invoke(hook, this, locals);
}
return hook ? decoratedNg1Hook : undefined;
};
};
//# sourceMappingURL=onEnterExitRetain.js.map
\ No newline at end of file
{
"version": 3,
"file": "onEnterExitRetain.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/statebuilders/onEnterExitRetain.ts"
],
"names": [],
"mappings": "AAAA,6BAA6B,CAAC,MAAM;AACpC,OAAO,EAKL,QAAQ,EACR,cAAc,EACd,MAAM,GAEP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAC,QAA2C;IAC7E,OAAA,SAAS,gBAAgB,CAAC,WAAwB,EAAE,QAAyB;QAC3E,IAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAM,QAAQ,GAAG,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QAEvD,SAAS,gBAAgB,CAAC,KAAiB,EAAE,KAA0B;YACrE,IAAM,cAAc,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;YACvE,IAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9D,IAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;YACtF,OAAO,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7C,CAAC;AAZD,CAYC,CAAC",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\nimport {\n StateObject,\n TransitionStateHookFn,\n HookResult,\n Transition,\n services,\n ResolveContext,\n extend,\n BuilderFunction,\n} from '@uirouter/core';\nimport { getLocals } from '../services';\nimport { Ng1StateDeclaration } from '../interface';\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,\n * `onRetain` callback hooks on a [[Ng1StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * ensures that those hooks are injectable for @uirouter/angularjs (ng1).\n *\n * @internalapi\n */\nexport const getStateHookBuilder = (hookName: 'onEnter' | 'onExit' | 'onRetain') =>\n function stateHookBuilder(stateObject: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {\n const hook = stateObject[hookName];\n const pathname = hookName === 'onExit' ? 'from' : 'to';\n\n function decoratedNg1Hook(trans: Transition, state: Ng1StateDeclaration): HookResult {\n const resolveContext = new ResolveContext(trans.treeChanges(pathname));\n const subContext = resolveContext.subContext(state.$$state());\n const locals = extend(getLocals(subContext), { $state$: state, $transition$: trans });\n return services.$injector.invoke(hook, this, locals);\n }\n\n return hook ? decoratedNg1Hook : undefined;\n };\n"
]
}
\ No newline at end of file
import { StateObject, ViewConfig, ViewConfigFactory, PathNode, ResolveContext, IInjectable } from '@uirouter/core';
import { Ng1ViewDeclaration } from '../interface';
import { TemplateFactory } from '../templateFactory';
/** @internalapi */
export declare function getNg1ViewConfigFactory(): ViewConfigFactory;
/**
* This is a [[StateBuilder.builder]] function for angular1 `views`.
*
* When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder
* handles the `views` property with logic specific to @uirouter/angularjs (ng1).
*
* If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object
* and applies the state-level configuration to a view named `$default`.
*
* @internalapi
*/
export declare function ng1ViewsBuilder(state: StateObject): {};
/** @internalapi */
export declare class Ng1ViewConfig implements ViewConfig {
path: PathNode[];
viewDecl: Ng1ViewDeclaration;
factory: TemplateFactory;
$id: number;
loaded: boolean;
controller: Function;
template: string;
component: string;
locals: any;
constructor(path: PathNode[], viewDecl: Ng1ViewDeclaration, factory: TemplateFactory);
load(): Promise<this>;
getTemplate: (uiView: any, context: ResolveContext) => string;
/**
* Gets the controller for a view configuration.
*
* @returns {Function|Promise.<Function>} Returns a controller, or a promise that resolves to a controller.
*/
getController(context: ResolveContext): IInjectable | string | Promise<IInjectable | string>;
}
import { pick, forEach, tail, extend, isArray, isInjectable, isDefined, isString, services, trace, ViewService, ResolveContext, Resolvable, } from '@uirouter/core';
/** @internalapi */
export function getNg1ViewConfigFactory() {
var templateFactory = null;
return function (path, view) {
templateFactory = templateFactory || services.$injector.get('$templateFactory');
return [new Ng1ViewConfig(path, view, templateFactory)];
};
}
/** @internalapi */
var hasAnyKey = function (keys, obj) { return keys.reduce(function (acc, key) { return acc || isDefined(obj[key]); }, false); };
/**
* This is a [[StateBuilder.builder]] function for angular1 `views`.
*
* When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder
* handles the `views` property with logic specific to @uirouter/angularjs (ng1).
*
* If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object
* and applies the state-level configuration to a view named `$default`.
*
* @internalapi
*/
export function ng1ViewsBuilder(state) {
// Do not process root state
if (!state.parent)
return {};
var tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'], ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'], compKeys = ['component', 'bindings', 'componentProvider'], nonCompKeys = tplKeys.concat(ctrlKeys), allViewKeys = compKeys.concat(nonCompKeys);
// Do not allow a state to have both state-level props and also a `views: {}` property.
// A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.
// However, the `$default` approach should not be mixed with a separate `views: ` block.
if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {
throw new Error("State '" + state.name + "' has a 'views' object. " +
"It cannot also have \"view properties\" at the state level. " +
"Move the following properties into a view (in the 'views' object): " +
(" " + allViewKeys.filter(function (key) { return isDefined(state[key]); }).join(', ')));
}
var views = {}, viewsObject = state.views || { $default: pick(state, allViewKeys) };
forEach(viewsObject, function (config, name) {
// Account for views: { "": { template... } }
name = name || '$default';
// Account for views: { header: "headerComponent" }
if (isString(config))
config = { component: config };
// Make a shallow copy of the config object
config = extend({}, config);
// Do not allow a view to mix props for component-style view with props for template/controller-style view
if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {
throw new Error("Cannot combine: " + compKeys.join('|') + " with: " + nonCompKeys.join('|') + " in stateview: '" + name + "@" + state.name + "'");
}
config.resolveAs = config.resolveAs || '$resolve';
config.$type = 'ng1';
config.$context = state;
config.$name = name;
var normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);
config.$uiViewName = normalized.uiViewName;
config.$uiViewContextAnchor = normalized.uiViewContextAnchor;
views[name] = config;
});
return views;
}
/** @hidden */
var id = 0;
/** @internalapi */
var Ng1ViewConfig = /** @class */ (function () {
function Ng1ViewConfig(path, viewDecl, factory) {
var _this = this;
this.path = path;
this.viewDecl = viewDecl;
this.factory = factory;
this.$id = id++;
this.loaded = false;
this.getTemplate = function (uiView, context) {
return _this.component
? _this.factory.makeComponentTemplate(uiView, context, _this.component, _this.viewDecl.bindings)
: _this.template;
};
}
Ng1ViewConfig.prototype.load = function () {
var _this = this;
var $q = services.$q;
var context = new ResolveContext(this.path);
var params = this.path.reduce(function (acc, node) { return extend(acc, node.paramValues); }, {});
var promises = {
template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),
controller: $q.when(this.getController(context)),
};
return $q.all(promises).then(function (results) {
trace.traceViewServiceEvent('Loaded', _this);
_this.controller = results.controller;
extend(_this, results.template); // Either { template: "tpl" } or { component: "cmpName" }
return _this;
});
};
/**
* Gets the controller for a view configuration.
*
* @returns {Function|Promise.<Function>} Returns a controller, or a promise that resolves to a controller.
*/
Ng1ViewConfig.prototype.getController = function (context) {
var provider = this.viewDecl.controllerProvider;
if (!isInjectable(provider))
return this.viewDecl.controller;
var deps = services.$injector.annotate(provider);
var providerFn = isArray(provider) ? tail(provider) : provider;
var resolvable = new Resolvable('', providerFn, deps);
return resolvable.get(context);
};
return Ng1ViewConfig;
}());
export { Ng1ViewConfig };
//# sourceMappingURL=views.js.map
\ No newline at end of file
{
"version": 3,
"file": "views.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/statebuilders/views.ts"
],
"names": [],
"mappings": "AAEA,OAAO,EAEL,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,MAAM,EACN,OAAO,EACP,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,KAAK,EAEL,WAAW,EAGX,cAAc,EACd,UAAU,GAEX,MAAM,gBAAgB,CAAC;AAKxB,mBAAmB;AACnB,MAAM,UAAU,uBAAuB;IACrC,IAAI,eAAe,GAAoB,IAAI,CAAC;IAC5C,OAAO,UAAC,IAAI,EAAE,IAAI;QAChB,eAAe,GAAG,eAAe,IAAI,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC;AAED,mBAAmB;AACnB,IAAM,SAAS,GAAG,UAAC,IAAI,EAAE,GAAG,IAAK,OAAA,IAAI,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,GAAG,IAAK,OAAA,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAA1B,CAA0B,EAAE,KAAK,CAAC,EAA5D,CAA4D,CAAC;AAE9F;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,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I,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAClD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC7D,IAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACtE,IAAM,UAAU,GAAG,IAAI,UAAU,CAAC,EAAE,EAAO,UAAU,EAAE,IAAI,CAAC,CAAC;QAC7D,OAAO,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IACH,oBAAC;AAAD,CAAC,AA9CD,IA8CC",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\nimport { ng as angular } from '../angular';\nimport {\n StateObject,\n pick,\n forEach,\n tail,\n extend,\n isArray,\n isInjectable,\n isDefined,\n isString,\n services,\n trace,\n ViewConfig,\n ViewService,\n ViewConfigFactory,\n PathNode,\n ResolveContext,\n Resolvable,\n IInjectable,\n} from '@uirouter/core';\nimport { Ng1ViewDeclaration } from '../interface';\nimport { TemplateFactory } from '../templateFactory';\nimport IInjectorService = angular.auto.IInjectorService;\n\n/** @internalapi */\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n let templateFactory: TemplateFactory = null;\n return (path, view) => {\n templateFactory = templateFactory || services.$injector.get('$templateFactory');\n return [new Ng1ViewConfig(path, view, templateFactory)];\n };\n}\n\n/** @internalapi */\nconst hasAnyKey = (keys, obj) => keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n *\n * @internalapi\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n // Do not process root state\n if (!state.parent) return {};\n\n const tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n compKeys = ['component', 'bindings', 'componentProvider'],\n nonCompKeys = tplKeys.concat(ctrlKeys),\n allViewKeys = compKeys.concat(nonCompKeys);\n\n // Do not allow a state to have both state-level props and also a `views: {}` property.\n // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n // However, the `$default` approach should not be mixed with a separate `views: ` block.\n if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n throw new Error(\n `State '${state.name}' has a 'views' object. ` +\n `It cannot also have \"view properties\" at the state level. ` +\n `Move the following properties into a view (in the 'views' object): ` +\n ` ${allViewKeys.filter(key => isDefined(state[key])).join(', ')}`\n );\n }\n\n const views: { [key: string]: Ng1ViewDeclaration } = {},\n viewsObject = state.views || { $default: pick(state, allViewKeys) };\n\n forEach(viewsObject, function(config: Ng1ViewDeclaration, name: string) {\n // Account for views: { \"\": { template... } }\n name = name || '$default';\n // Account for views: { header: \"headerComponent\" }\n if (isString(config)) config = { component: <string>config };\n\n // Make a shallow copy of the config object\n config = extend({}, config);\n\n // Do not allow a view to mix props for component-style view with props for template/controller-style view\n if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n throw new Error(\n `Cannot combine: ${compKeys.join('|')} with: ${nonCompKeys.join('|')} in stateview: '${name}@${state.name}'`\n );\n }\n\n config.resolveAs = config.resolveAs || '$resolve';\n config.$type = 'ng1';\n config.$context = state;\n config.$name = name;\n\n const normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n config.$uiViewName = normalized.uiViewName;\n config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n views[name] = config;\n });\n return views;\n}\n\n/** @hidden */\nlet id = 0;\n\n/** @internalapi */\nexport class Ng1ViewConfig implements ViewConfig {\n $id = id++;\n loaded = false;\n controller: Function; // actually IInjectable|string\n template: string;\n component: string;\n locals: any; // TODO: delete me\n\n constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) {}\n\n load() {\n const $q = services.$q;\n const context = new ResolveContext(this.path);\n const params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n const promises: any = {\n template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n controller: $q.when(this.getController(context)),\n };\n\n return $q.all(promises).then(results => {\n trace.traceViewServiceEvent('Loaded', this);\n this.controller = results.controller;\n extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n return this;\n });\n }\n\n getTemplate = (uiView, context: ResolveContext) =>\n this.component\n ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings)\n : this.template;\n\n /**\n * Gets the controller for a view configuration.\n *\n * @returns {Function|Promise.<Function>} Returns a controller, or a promise that resolves to a controller.\n */\n getController(context: ResolveContext): IInjectable | string | Promise<IInjectable | string> {\n const provider = this.viewDecl.controllerProvider;\n if (!isInjectable(provider)) return this.viewDecl.controller;\n const deps = services.$injector.annotate(provider);\n const providerFn = isArray(provider) ? tail(<any>provider) : provider;\n const resolvable = new Resolvable('', <any>providerFn, deps);\n return resolvable.get(context);\n }\n}\n"
]
}
\ No newline at end of file
import { IAugmentedJQuery } from 'angular';
import { IInjectable, ResolveContext, RawParams } from '@uirouter/core';
import { Ng1ViewDeclaration, TemplateFactoryProvider } from './interface';
/**
* Service which manages loading of templates from a ViewConfig.
*/
export declare class TemplateFactory implements TemplateFactoryProvider {
/** @hidden */ private _useHttp;
/** @hidden */ private $templateRequest;
/** @hidden */ private $templateCache;
/** @hidden */ private $http;
/** @hidden */ $get: (string | (($http: any, $templateCache: any, $injector: any) => this))[];
/** @hidden */
useHttpService(value: boolean): void;
/**
* Creates a template from a configuration object.
*
* @param config Configuration object for which to load a template.
* The following properties are search in the specified order, and the first one
* that is defined is used to create the template:
*
* @param params Parameters to pass to the template function.
* @param context The resolve context associated with the template's view
*
* @return {string|object} The template html as a string, or a promise for
* that string,or `null` if no template is configured.
*/
fromConfig(config: Ng1ViewDeclaration, params: any, context: ResolveContext): Promise<{
template?: string;
component?: string;
}>;
/**
* Creates a template from a string or a function returning a string.
*
* @param template html template as a string or function that returns an html template as a string.
* @param params Parameters to pass to the template function.
*
* @return {string|object} The template html as a string, or a promise for that
* string.
*/
fromString(template: string | Function, params?: RawParams): any;
/**
* Loads a template from the a URL via `$http` and `$templateCache`.
*
* @param {string|Function} url url of the template to load, or a function
* that returns a url.
* @param {Object} params Parameters to pass to the url function.
* @return {string|Promise.<string>} The template html as a string, or a promise
* for that string.
*/
fromUrl(url: string | Function, params: any): any;
/**
* Creates a template by invoking an injectable provider function.
*
* @param provider Function to invoke via `locals`
* @param {Function} injectFn a function used to invoke the template provider
* @return {string|Promise.<string>} The template html as a string, or a promise
* for that string.
*/
fromProvider(provider: IInjectable, params: any, context: ResolveContext): Promise<any>;
/**
* Creates a component's template by invoking an injectable provider function.
*
* @param provider Function to invoke via `locals`
* @param {Function} injectFn a function used to invoke the template provider
* @return {string} The template html as a string: "<component-name input1='::$resolve.foo'></component-name>".
*/
fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext): Promise<any>;
/**
* Creates a template from a component's name
*
* This implements route-to-component.
* It works by retrieving the component (directive) metadata from the injector.
* It analyses the component's bindings, then constructs a template that instantiates the component.
* The template wires input and output bindings to resolves or from the parent component.
*
* @param uiView {object} The parent ui-view (for binding outputs to callbacks)
* @param context The ResolveContext (for binding outputs to callbacks returned from resolves)
* @param component {string} Component's name in camel case.
* @param bindings An object defining the component's bindings: {foo: '<'}
* @return {string} The template as a string: "<component-name input1='::$resolve.foo'></component-name>".
*/
makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any): string;
}
/** @publicapi @module url */ /** */
import { UIRouter, LocationServices, $InjectorLike, UrlRuleHandlerFn, UrlMatcher, IInjectable, UrlRouter } from '@uirouter/core';
export interface RawNg1RuleFunction {
($injector: $InjectorLike, $location: LocationServices): string | void;
}
/**
* Manages rules for client-side URL
*
* ### Deprecation warning:
* This class is now considered to be an internal API
* Use the [[UrlService]] instead.
* For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].
*
* This class manages the router rules for what to do when the URL changes.
*
* This provider remains for backwards compatibility.
*
* @internalapi
* @deprecated
*/
export declare class UrlRouterProvider {
private router;
static injectableHandler(router: UIRouter, handler: any): UrlRuleHandlerFn;
/** @hidden */
constructor(/** @hidden */ router: UIRouter);
/** @hidden */
$get(): UrlRouter;
/**
* Registers a url handler function.
*
* Registers a low level url handler (a `rule`).
* A rule detects specific URL patterns and returns a redirect, or performs some action.
*
* If a rule returns a string, the URL is replaced with the string, and all rules are fired again.
*
* #### Example:
* ```js
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
* // Here's an example of how you might allow case insensitive urls
* $urlRouterProvider.rule(function ($injector, $location) {
* var path = $location.path(),
* normalized = path.toLowerCase();
*
* if (path !== normalized) {
* return normalized;
* }
* });
* });
* ```
*
* @param ruleFn
* Handler function that takes `$injector` and `$location` services as arguments.
* You can use them to detect a url and return a different url as a string.
*
* @return [[UrlRouterProvider]] (`this`)
*/
rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider;
/**
* Defines the path or behavior to use when no url can be matched.
*
* #### Example:
* ```js
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
* // if the path doesn't match any of the urls you configured
* // otherwise will take care of routing the user to the
* // specified url
* $urlRouterProvider.otherwise('/index');
*
* // Example of using function rule as param
* $urlRouterProvider.otherwise(function ($injector, $location) {
* return '/a/valid/url';
* });
* });
* ```
*
* @param rule
* The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.
* The function version is passed two params: `$injector` and `$location` services, and should return a url string.
*
* @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance
*/
otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider;
/**
* Registers a handler for a given url matching.
*
* If the handler is a string, it is
* treated as a redirect, and is interpolated according to the syntax of match
* (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).
*
* If the handler is a function, it is injectable.
* It gets invoked if `$location` matches.
* You have the option of inject the match object as `$match`.
*
* The handler can return
*
* - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`
* will continue trying to find another one that matches.
* - **string** which is treated as a redirect and passed to `$location.url()`
* - **void** or any **truthy** value tells `$urlRouter` that the url was handled.
*
* #### Example:
* ```js
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
* $urlRouterProvider.when($state.url, function ($match, $stateParams) {
* if ($state.$current.navigable !== state ||
* !equalForKeys($match, $stateParams) {
* $state.transitionTo(state, $match, false);
* }
* });
* });
* ```
*
* @param what A pattern string to match, compiled as a [[UrlMatcher]].
* @param handler The path (or function that returns a path) that you want to redirect your user to.
* @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]
*
* Note: the handler may also invoke arbitrary code, such as `$state.go()`
*/
when(what: RegExp | UrlMatcher | string, handler: string | IInjectable): this;
/**
* Disables monitoring of the URL.
*
* Call this method before UI-Router has bootstrapped.
* It will stop UI-Router from performing the initial url sync.
*
* This can be useful to perform some asynchronous initialization before the router starts.
* Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.
*
* #### Example:
* ```js
* var app = angular.module('app', ['ui.router']);
*
* app.config(function ($urlRouterProvider) {
* // Prevent $urlRouter from automatically intercepting URL changes;
* $urlRouterProvider.deferIntercept();
* })
*
* app.run(function (MyService, $urlRouter, $http) {
* $http.get("/stuff").then(function(resp) {
* MyService.doStuff(resp.data);
* $urlRouter.listen();
* $urlRouter.sync();
* });
* });
* ```
*
* @param defer Indicates whether to defer location change interception.
* Passing no parameter is equivalent to `true`.
*/
deferIntercept(defer?: boolean): void;
}
/** @publicapi @module url */ /** */
import { BaseUrlRule, } from '@uirouter/core';
import { services, isString, isFunction, isArray, identity } from '@uirouter/core';
/**
* Manages rules for client-side URL
*
* ### Deprecation warning:
* This class is now considered to be an internal API
* Use the [[UrlService]] instead.
* For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].
*
* This class manages the router rules for what to do when the URL changes.
*
* This provider remains for backwards compatibility.
*
* @internalapi
* @deprecated
*/
var UrlRouterProvider = /** @class */ (function () {
/** @hidden */
function UrlRouterProvider(/** @hidden */ router) {
this.router = router;
}
UrlRouterProvider.injectableHandler = function (router, handler) {
return function (match) { return services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params }); };
};
/** @hidden */
UrlRouterProvider.prototype.$get = function () {
var urlService = this.router.urlService;
this.router.urlRouter.update(true);
if (!urlService.interceptDeferred)
urlService.listen();
return this.router.urlRouter;
};
/**
* Registers a url handler function.
*
* Registers a low level url handler (a `rule`).
* A rule detects specific URL patterns and returns a redirect, or performs some action.
*
* If a rule returns a string, the URL is replaced with the string, and all rules are fired again.
*
* #### Example:
* ```js
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
* // Here's an example of how you might allow case insensitive urls
* $urlRouterProvider.rule(function ($injector, $location) {
* var path = $location.path(),
* normalized = path.toLowerCase();
*
* if (path !== normalized) {
* return normalized;
* }
* });
* });
* ```
*
* @param ruleFn
* Handler function that takes `$injector` and `$location` services as arguments.
* You can use them to detect a url and return a different url as a string.
*
* @return [[UrlRouterProvider]] (`this`)
*/
UrlRouterProvider.prototype.rule = function (ruleFn) {
var _this = this;
if (!isFunction(ruleFn))
throw new Error("'rule' must be a function");
var match = function () { return ruleFn(services.$injector, _this.router.locationService); };
var rule = new BaseUrlRule(match, identity);
this.router.urlService.rules.rule(rule);
return this;
};
/**
* Defines the path or behavior to use when no url can be matched.
*
* #### Example:
* ```js
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
* // if the path doesn't match any of the urls you configured
* // otherwise will take care of routing the user to the
* // specified url
* $urlRouterProvider.otherwise('/index');
*
* // Example of using function rule as param
* $urlRouterProvider.otherwise(function ($injector, $location) {
* return '/a/valid/url';
* });
* });
* ```
*
* @param rule
* The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.
* The function version is passed two params: `$injector` and `$location` services, and should return a url string.
*
* @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance
*/
UrlRouterProvider.prototype.otherwise = function (rule) {
var _this = this;
var urlRules = this.router.urlService.rules;
if (isString(rule)) {
urlRules.otherwise(rule);
}
else if (isFunction(rule)) {
urlRules.otherwise(function () { return rule(services.$injector, _this.router.locationService); });
}
else {
throw new Error("'rule' must be a string or function");
}
return this;
};
/**
* Registers a handler for a given url matching.
*
* If the handler is a string, it is
* treated as a redirect, and is interpolated according to the syntax of match
* (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).
*
* If the handler is a function, it is injectable.
* It gets invoked if `$location` matches.
* You have the option of inject the match object as `$match`.
*
* The handler can return
*
* - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`
* will continue trying to find another one that matches.
* - **string** which is treated as a redirect and passed to `$location.url()`
* - **void** or any **truthy** value tells `$urlRouter` that the url was handled.
*
* #### Example:
* ```js
* var app = angular.module('app', ['ui.router.router']);
*
* app.config(function ($urlRouterProvider) {
* $urlRouterProvider.when($state.url, function ($match, $stateParams) {
* if ($state.$current.navigable !== state ||
* !equalForKeys($match, $stateParams) {
* $state.transitionTo(state, $match, false);
* }
* });
* });
* ```
*
* @param what A pattern string to match, compiled as a [[UrlMatcher]].
* @param handler The path (or function that returns a path) that you want to redirect your user to.
* @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]
*
* Note: the handler may also invoke arbitrary code, such as `$state.go()`
*/
UrlRouterProvider.prototype.when = function (what, handler) {
if (isArray(handler) || isFunction(handler)) {
handler = UrlRouterProvider.injectableHandler(this.router, handler);
}
this.router.urlService.rules.when(what, handler);
return this;
};
/**
* Disables monitoring of the URL.
*
* Call this method before UI-Router has bootstrapped.
* It will stop UI-Router from performing the initial url sync.
*
* This can be useful to perform some asynchronous initialization before the router starts.
* Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.
*
* #### Example:
* ```js
* var app = angular.module('app', ['ui.router']);
*
* app.config(function ($urlRouterProvider) {
* // Prevent $urlRouter from automatically intercepting URL changes;
* $urlRouterProvider.deferIntercept();
* })
*
* app.run(function (MyService, $urlRouter, $http) {
* $http.get("/stuff").then(function(resp) {
* MyService.doStuff(resp.data);
* $urlRouter.listen();
* $urlRouter.sync();
* });
* });
* ```
*
* @param defer Indicates whether to defer location change interception.
* Passing no parameter is equivalent to `true`.
*/
UrlRouterProvider.prototype.deferIntercept = function (defer) {
this.router.urlService.deferIntercept(defer);
};
return UrlRouterProvider;
}());
export { UrlRouterProvider };
//# sourceMappingURL=urlRouterProvider.js.map
\ No newline at end of file
{
"version": 3,
"file": "urlRouterProvider.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/urlRouterProvider.ts"
],
"names": [],
"mappings": "AAAA,6BAA6B,CAAC,MAAM;AACpC,OAAO,EAIL,WAAW,GAKZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAMnF;;;;;;;;;;;;;;GAcG;AACH;IAKE,cAAc;IACd,2BAAY,cAAc,CAAS,MAAgB;QAAhB,WAAM,GAAN,MAAM,CAAU;IAAG,CAAC;IALhD,mCAAiB,GAAxB,UAAyB,MAAgB,EAAE,OAAO;QAChD,OAAO,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,MA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,SAAS,EAAE,KAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAArD,CAAqD,CAAC,CAAC;SACjF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,gCAAI,GAAJ,UAAK,IAAkC,EAAE,OAA6B;QACpE,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE;YAC3C,OAAO,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACrE;QAED,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAc,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,0CAAc,GAAd,UAAe,KAAe;QAC5B,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IACH,wBAAC;AAAD,CAAC,AAhLD,IAgLC",
"sourcesContent": [
"/** @publicapi @module url */ /** */\nimport {\n UIRouter,\n LocationServices,\n $InjectorLike,\n BaseUrlRule,\n UrlRuleHandlerFn,\n UrlMatcher,\n IInjectable,\n UrlRouter,\n} from '@uirouter/core';\nimport { services, isString, isFunction, isArray, identity } from '@uirouter/core';\n\nexport interface RawNg1RuleFunction {\n ($injector: $InjectorLike, $location: LocationServices): string | void;\n}\n\n/**\n * Manages rules for client-side URL\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @internalapi\n * @deprecated\n */\nexport class UrlRouterProvider {\n static injectableHandler(router: UIRouter, handler): UrlRuleHandlerFn {\n return match => services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params });\n }\n\n /** @hidden */\n constructor(/** @hidden */ private router: UIRouter) {}\n\n /** @hidden */\n $get(): UrlRouter {\n const urlService = this.router.urlService;\n this.router.urlRouter.update(true);\n if (!urlService.interceptDeferred) urlService.listen();\n return this.router.urlRouter;\n }\n\n /**\n * Registers a url handler function.\n *\n * Registers a low level url handler (a `rule`).\n * A rule detects specific URL patterns and returns a redirect, or performs some action.\n *\n * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Here's an example of how you might allow case insensitive urls\n * $urlRouterProvider.rule(function ($injector, $location) {\n * var path = $location.path(),\n * normalized = path.toLowerCase();\n *\n * if (path !== normalized) {\n * return normalized;\n * }\n * });\n * });\n * ```\n *\n * @param ruleFn\n * Handler function that takes `$injector` and `$location` services as arguments.\n * You can use them to detect a url and return a different url as a string.\n *\n * @return [[UrlRouterProvider]] (`this`)\n */\n rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider {\n if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n const match = () => ruleFn(services.$injector, this.router.locationService);\n\n const rule = new BaseUrlRule(match, identity);\n this.router.urlService.rules.rule(rule);\n return this;\n }\n\n /**\n * Defines the path or behavior to use when no url can be matched.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // if the path doesn't match any of the urls you configured\n * // otherwise will take care of routing the user to the\n * // specified url\n * $urlRouterProvider.otherwise('/index');\n *\n * // Example of using function rule as param\n * $urlRouterProvider.otherwise(function ($injector, $location) {\n * return '/a/valid/url';\n * });\n * });\n * ```\n *\n * @param rule\n * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n *\n * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n */\n otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider {\n const urlRules = this.router.urlService.rules;\n if (isString(rule)) {\n urlRules.otherwise(rule);\n } else if (isFunction(rule)) {\n urlRules.otherwise(() => rule(services.$injector, this.router.locationService));\n } else {\n throw new Error(\"'rule' must be a string or function\");\n }\n\n return this;\n }\n\n /**\n * Registers a handler for a given url matching.\n *\n * If the handler is a string, it is\n * treated as a redirect, and is interpolated according to the syntax of match\n * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n *\n * If the handler is a function, it is injectable.\n * It gets invoked if `$location` matches.\n * You have the option of inject the match object as `$match`.\n *\n * The handler can return\n *\n * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n * will continue trying to find another one that matches.\n * - **string** which is treated as a redirect and passed to `$location.url()`\n * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n * if ($state.$current.navigable !== state ||\n * !equalForKeys($match, $stateParams) {\n * $state.transitionTo(state, $match, false);\n * }\n * });\n * });\n * ```\n *\n * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n * @param handler The path (or function that returns a path) that you want to redirect your user to.\n * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n *\n * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n */\n when(what: RegExp | UrlMatcher | string, handler: string | IInjectable) {\n if (isArray(handler) || isFunction(handler)) {\n handler = UrlRouterProvider.injectableHandler(this.router, handler);\n }\n\n this.router.urlService.rules.when(what, handler as any);\n return this;\n }\n\n /**\n * Disables monitoring of the URL.\n *\n * Call this method before UI-Router has bootstrapped.\n * It will stop UI-Router from performing the initial url sync.\n *\n * This can be useful to perform some asynchronous initialization before the router starts.\n * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n *\n * #### Example:\n * ```js\n * var app = angular.module('app', ['ui.router']);\n *\n * app.config(function ($urlRouterProvider) {\n * // Prevent $urlRouter from automatically intercepting URL changes;\n * $urlRouterProvider.deferIntercept();\n * })\n *\n * app.run(function (MyService, $urlRouter, $http) {\n * $http.get(\"/stuff\").then(function(resp) {\n * MyService.doStuff(resp.data);\n * $urlRouter.listen();\n * $urlRouter.sync();\n * });\n * });\n * ```\n *\n * @param defer Indicates whether to defer location change interception.\n * Passing no parameter is equivalent to `true`.\n */\n deferIntercept(defer?: boolean) {\n this.router.urlService.deferIntercept(defer);\n }\n}\n"
]
}
\ No newline at end of file
export interface UIViewScrollProvider {
/**
* Uses standard anchorScroll behavior
*
* Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
* service for scrolling based on the url anchor.
*/
useAnchorScroll(): void;
}
/** @publicapi @module ng1 */ /** */
import { ng as angular } from './angular';
/** @hidden */
function $ViewScrollProvider() {
var useAnchorScroll = false;
this.useAnchorScroll = function () {
useAnchorScroll = true;
};
this.$get = [
'$anchorScroll',
'$timeout',
function ($anchorScroll, $timeout) {
if (useAnchorScroll) {
return $anchorScroll;
}
return function ($element) {
return $timeout(function () {
$element[0].scrollIntoView();
}, 0, false);
};
},
];
}
angular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);
//# sourceMappingURL=viewScroll.js.map
\ No newline at end of file
{
"version": 3,
"file": "viewScroll.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/viewScroll.ts"
],
"names": [],
"mappings": "AAAA,6BAA6B,CAAC,MAAM;AACpC,OAAO,EAAE,EAAE,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAe1C,cAAc;AACd,SAAS,mBAAmB;IAC1B,IAAI,eAAe,GAAG,KAAK,CAAC;IAE5B,IAAI,CAAC,eAAe,GAAG;QACrB,eAAe,GAAG,IAAI,CAAC;IACzB,CAAC,CAAC;IAEF,IAAI,CAAC,IAAI,GAAG;QACV,eAAe;QACf,UAAU;QACV,UAAS,aAAmC,EAAE,QAAyB;YACrE,IAAI,eAAe,EAAE;gBACnB,OAAO,aAAa,CAAC;aACtB;YAED,OAAO,UAAS,QAAgB;gBAC9B,OAAO,QAAQ,CACb;oBACE,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;gBAC/B,CAAC,EACD,CAAC,EACD,KAAK,CACN,CAAC;YACJ,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,eAAe,EAA2B,mBAAmB,CAAC,CAAC",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\nimport { ng as angular } from './angular';\nimport { IServiceProviderFactory } from 'angular';\nimport IAnchorScrollService = angular.IAnchorScrollService;\nimport ITimeoutService = angular.ITimeoutService;\n\nexport interface UIViewScrollProvider {\n /**\n * Uses standard anchorScroll behavior\n *\n * Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * service for scrolling based on the url anchor.\n */\n useAnchorScroll(): void;\n}\n\n/** @hidden */\nfunction $ViewScrollProvider() {\n let useAnchorScroll = false;\n\n this.useAnchorScroll = function() {\n useAnchorScroll = true;\n };\n\n this.$get = [\n '$anchorScroll',\n '$timeout',\n function($anchorScroll: IAnchorScrollService, $timeout: ITimeoutService): Function {\n if (useAnchorScroll) {\n return $anchorScroll;\n }\n\n return function($element: JQuery) {\n return $timeout(\n function() {\n $element[0].scrollIntoView();\n },\n 0,\n false\n );\n };\n },\n ];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', <IServiceProviderFactory>$ViewScrollProvider);\n"
]
}
\ No newline at end of file
/** @hidden */ export declare const ng: any;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** @publicapi @module ng1 */ /** */
var ng_from_import = require("angular");
/** @hidden */ var ng_from_global = angular;
/** @hidden */ exports.ng = ng_from_import && ng_from_import.module ? ng_from_import : ng_from_global;
//# sourceMappingURL=angular.js.map
\ No newline at end of file
{
"version": 3,
"file": "angular.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/angular.ts"
],
"names": [],
"mappings": ";;AAAA,6BAA6B,CAAC,MAAM;AACpC,wCAA0C;AAE1C,cAAc,CAAC,IAAM,cAAc,GAAG,OAAO,CAAC;AAC9C,cAAc,CAAc,QAAA,EAAE,GAAG,cAAc,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\nimport * as ng_from_import from 'angular';\n/** @hidden */ declare var angular;\n/** @hidden */ const ng_from_global = angular;\n/** @hidden */ export const ng = ng_from_import && ng_from_import.module ? ng_from_import : ng_from_global;\n"
]
}
\ No newline at end of file
/** @hidden Used for typedoc */
export interface ng1_directive {
}
...@@ -471,10 +471,10 @@ uiStateDirective = [ ...@@ -471,10 +471,10 @@ uiStateDirective = [
* the specified state names/globs, even the abstract ones. * the specified state names/globs, even the abstract ones.
* *
* #### Example: * #### Example:
* Given the following template, with "admin" being an abstract state: * Given the following template, with "common" being an abstract state:
* ```html * ```html
* <div ui-sref-active="{'active': 'admin.**'}"> * <div ui-sref-active="{'active': 'common.**'}">
* <a ui-sref-active="active" ui-sref="admin.roles">Roles</a> * <a ui-sref-active="active" ui-sref="common.roles">Roles</a>
* </div> * </div>
* ``` * ```
* *
...@@ -482,14 +482,14 @@ uiStateDirective = [ ...@@ -482,14 +482,14 @@ uiStateDirective = [
* This allows multiple states to add `active` class. * This allows multiple states to add `active` class.
* *
* #### Example: * #### Example:
* Given the following template, with "admin.roles" being the current state, the class will be added too: * Given the following template, with "common.roles" being the current state, the class will be added too:
* ```html * ```html
* <div ui-sref-active="{'active': ['owner.**', 'admin.**']}"> * <div ui-sref-active="{'active': ['owner.**', 'common.**']}">
* <a ui-sref-active="active" ui-sref="admin.roles">Roles</a> * <a ui-sref-active="active" ui-sref="common.roles">Roles</a>
* </div> * </div>
* ``` * ```
* *
* When the current state is "admin.roles" the "active" class will be applied to both the `<div>` and `<a>` elements. * When the current state is "common.roles" the "active" class will be applied to both the `<div>` and `<a>` elements.
* It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`. * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.
* *
* ### Notes: * ### Notes:
......
/** @publicapi @module directives */ /** */
import { ActiveUIView } from '@uirouter/core';
import { Ng1ViewConfig } from '../statebuilders/views';
import { ng1_directive } from './stateDirectives';
/** @hidden */
export declare type UIViewData = {
$cfg: Ng1ViewConfig;
$uiView: ActiveUIView;
};
/** @hidden */
export declare type UIViewAnimData = {
$animEnter: Promise<any>;
$animLeave: Promise<any>;
$$animLeave: {
resolve: () => any;
};
};
/**
* `ui-view`: A viewport directive which is filled in by a view from the active state.
*
* ### Attributes
*
* - `name`: (Optional) A view name.
* The name should be unique amongst the other views in the same state.
* You can have views of the same name that live in different states.
* The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).
*
* - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.
* Uses [[$uiViewScroll]] to do the scrolling.
*
* - `onload`: Expression to evaluate whenever the view updates.
*
* #### Example:
* A view can be unnamed or named.
* ```html
* <!-- Unnamed -->
* <div ui-view></div>
*
* <!-- Named -->
* <div ui-view="viewName"></div>
*
* <!-- Named (different style) -->
* <ui-view name="viewName"></ui-view>
* ```
*
* You can only have one unnamed view within any template (or root html). If you are only using a
* single view and it is unnamed then you can populate it like so:
*
* ```html
* <div ui-view></div>
* $stateProvider.state("home", {
* template: "<h1>HELLO!</h1>"
* })
* ```
*
* The above is a convenient shortcut equivalent to specifying your view explicitly with the
* [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:
*
* ```js
* $stateProvider.state("home", {
* views: {
* "": {
* template: "<h1>HELLO!</h1>"
* }
* }
* })
* ```
*
* But typically you'll only use the views property if you name your view or have more than one view
* in the same template. There's not really a compelling reason to name a view if its the only one,
* but you could if you wanted, like so:
*
* ```html
* <div ui-view="main"></div>
* ```
*
* ```js
* $stateProvider.state("home", {
* views: {
* "main": {
* template: "<h1>HELLO!</h1>"
* }
* }
* })
* ```
*
* Really though, you'll use views to set up multiple views:
*
* ```html
* <div ui-view></div>
* <div ui-view="chart"></div>
* <div ui-view="data"></div>
* ```
*
* ```js
* $stateProvider.state("home", {
* views: {
* "": {
* template: "<h1>HELLO!</h1>"
* },
* "chart": {
* template: "<chart_thing/>"
* },
* "data": {
* template: "<data_thing/>"
* }
* }
* })
* ```
*
* #### Examples for `autoscroll`:
* ```html
* <!-- If autoscroll present with no expression,
* then scroll ui-view into view -->
* <ui-view autoscroll/>
*
* <!-- If autoscroll present with valid expression,
* then scroll ui-view into view if expression evaluates to true -->
* <ui-view autoscroll='true'/>
* <ui-view autoscroll='false'/>
* <ui-view autoscroll='scopeVariable'/>
* ```
*
* Resolve data:
*
* The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this
* can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.
*
* Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the
* controller is instantiated. The `$onInit()` hook can be used to perform initialization code which
* depends on `$resolve` data.
*
* #### Example:
* ```js
* $stateProvider.state('home', {
* template: '<my-component user="$resolve.user"></my-component>',
* resolve: {
* user: function(UserService) { return UserService.fetchUser(); }
* }
* });
* ```
*/
export declare let uiView: ng1_directive;
/**
* Main entry point for angular 1.x build
* @publicapi @module ng1
*/ /** */
export * from './interface';
export * from './services';
export * from './statebuilders/views';
export * from './stateProvider';
export * from './urlRouterProvider';
import './injectables';
import './directives/stateDirectives';
import './stateFilters';
import './directives/viewDirective';
import './viewScroll';
declare const _default: "ui.router";
export default _default;
import * as core from '@uirouter/core';
export { core };
export * from '@uirouter/core';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./services"));
__export(require("./statebuilders/views"));
__export(require("./stateProvider"));
__export(require("./urlRouterProvider"));
require("./injectables");
require("./directives/stateDirectives");
require("./stateFilters");
require("./directives/viewDirective");
require("./viewScroll");
exports.default = 'ui.router';
var core = require("@uirouter/core");
exports.core = core;
__export(require("@uirouter/core"));
//# sourceMappingURL=index.js.map
\ No newline at end of file
{
"version": 3,
"file": "index.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/index.ts"
],
"names": [],
"mappings": ";;;;;AAKA,gCAA2B;AAC3B,2CAAsC;AACtC,qCAAgC;AAChC,yCAAoC;AAEpC,yBAAuB;AACvB,wCAAsC;AACtC,0BAAwB;AACxB,sCAAoC;AACpC,wBAAsB;AAEtB,kBAAe,WAAW,CAAC;AAE3B,qCAAuC;AAC9B,oBAAI;AACb,oCAA+B",
"sourcesContent": [
"/**\n * Main entry point for angular 1.x build\n * @publicapi @module ng1\n */ /** */\nexport * from './interface';\nexport * from './services';\nexport * from './statebuilders/views';\nexport * from './stateProvider';\nexport * from './urlRouterProvider';\n\nimport './injectables';\nimport './directives/stateDirectives';\nimport './stateFilters';\nimport './directives/viewDirective';\nimport './viewScroll';\n\nexport default 'ui.router';\n\nimport * as core from '@uirouter/core';\nexport { core };\nexport * from '@uirouter/core';\n"
]
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interface.js.map
\ No newline at end of file
This diff is collapsed.
/** @hidden */
export declare const resolveFactory: () => {
/**
* Asynchronously injects a resolve block.
*
* This emulates most of the behavior of the ui-router 0.2.x $resolve.resolve() service API.
*
* ### Not bundled by default
*
* This API is no longer not part of the standard `@uirouter/angularjs` bundle.
* For users of the prebuilt bundles, add the `release/resolveService.min.js` UMD bundle.
* For bundlers (webpack, browserify, etc), add `@uirouter/angularjs/lib/legacy/resolveService`.
*
* ---
*
* Given an object `invocables`, where keys are strings and values are injectable functions,
* injects each function, and waits for the resulting promise to resolve.
* When all resulting promises are resolved, returns the results as an object.
*
* #### Example:
* ```js
* let invocables = {
* foo: [ '$http', ($http) =>
* $http.get('/api/foo').then(resp => resp.data) ],
* bar: [ 'foo', '$http', (foo, $http) =>
* $http.get('/api/bar/' + foo.barId).then(resp => resp.data) ]
* }
* $resolve.resolve(invocables)
* .then(results => console.log(results.foo, results.bar))
* // Logs foo and bar:
* // { id: 123, barId: 456, fooData: 'foo data' }
* // { id: 456, barData: 'bar data' }
* ```
*
* @param invocables an object which looks like an [[StateDeclaration.resolve]] object; keys are resolve names and values are injectable functions
* @param locals key/value pre-resolved data (locals)
* @param parent a promise for a "parent resolve"
*/
resolve: (invocables: {
[key: string]: Function;
}, locals?: {}, parent?: Promise<any>) => Promise<{}>;
};
{
"version": 3,
"file": "resolveService.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/legacy/resolveService.ts"
],
"names": [],
"mappings": ";;AAAA,6BAA6B,CAAC,MAAM;AACpC,uCAAwG;AACxG,iCAAmC;AAEnC;;GAEG;AACH,IAAM,QAAQ,GAAG;IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,OAAO,EAAE,UAAC,UAAuC,EAAE,MAAW,EAAE,MAAqB;QAAlC,uBAAA,EAAA,WAAW;QAC5D,IAAM,UAAU,GAAG,IAAI,eAAQ,CAAC,IAAI,kBAAW,CAAM,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACvF,IAAM,IAAI,GAAG,IAAI,eAAQ,CAAC,IAAI,kBAAW,CAAM,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACjF,IAAM,OAAO,GAAG,IAAI,qBAAc,CAAC,C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O,sBAAc,CAAC,CAAC",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\nimport { StateObject, PathNode, ResolveContext, Obj, mapObj, resolvablesBuilder } from '@uirouter/core';\nimport * as angular from 'angular';\n\n/**\n * Implementation of the legacy `$resolve` service for angular 1.\n */\nconst $resolve = {\n /**\n * Asynchronously injects a resolve block.\n *\n * This emulates most of the behavior of the ui-router 0.2.x $resolve.resolve() service API.\n *\n * ### Not bundled by default\n *\n * This API is no longer not part of the standard `@uirouter/angularjs` bundle.\n * For users of the prebuilt bundles, add the `release/resolveService.min.js` UMD bundle.\n * For bundlers (webpack, browserify, etc), add `@uirouter/angularjs/lib/legacy/resolveService`.\n *\n * ---\n *\n * Given an object `invocables`, where keys are strings and values are injectable functions,\n * injects each function, and waits for the resulting promise to resolve.\n * When all resulting promises are resolved, returns the results as an object.\n *\n * #### Example:\n * ```js\n * let invocables = {\n * foo: [ '$http', ($http) =>\n * $http.get('/api/foo').then(resp => resp.data) ],\n * bar: [ 'foo', '$http', (foo, $http) =>\n * $http.get('/api/bar/' + foo.barId).then(resp => resp.data) ]\n * }\n * $resolve.resolve(invocables)\n * .then(results => console.log(results.foo, results.bar))\n * // Logs foo and bar:\n * // { id: 123, barId: 456, fooData: 'foo data' }\n * // { id: 456, barData: 'bar data' }\n * ```\n *\n * @param invocables an object which looks like an [[StateDeclaration.resolve]] object; keys are resolve names and values are injectable functions\n * @param locals key/value pre-resolved data (locals)\n * @param parent a promise for a \"parent resolve\"\n */\n resolve: (invocables: { [key: string]: Function }, locals = {}, parent?: Promise<any>) => {\n const parentNode = new PathNode(new StateObject(<any>{ params: {}, resolvables: [] }));\n const node = new PathNode(new StateObject(<any>{ params: {}, resolvables: [] }));\n const context = new ResolveContext([parentNode, node]);\n\n context.addResolvables(resolvablesBuilder(<any>{ resolve: invocables }), node.state);\n\n const resolveData = (parentLocals: Obj) => {\n const rewrap = (_locals: Obj) => resolvablesBuilder(<any>{ resolve: mapObj(_locals, local => () => local) });\n context.addResolvables(rewrap(parentLocals), parentNode.state);\n context.addResolvables(rewrap(locals), node.state);\n\n const tuples2ObjR = (acc: Obj, tuple: { token: any; value: any }) => {\n acc[tuple.token] = tuple.value;\n return acc;\n };\n return context.resolvePath().then(results => results.reduce(tuples2ObjR, {}));\n };\n\n return parent ? parent.then(resolveData) : resolveData({});\n },\n};\n\n/** @hidden */\nexport const resolveFactory = () => $resolve;\n\n// The old $resolve service\nangular.module('ui.router').factory('$resolve', <any>resolveFactory);\n"
]
}
\ No newline at end of file
{
"version": 3,
"file": "locationServices.js",
"sourceRoot": "",
"sources": [
"@uirouter/angularjs/locationServices.ts"
],
"names": [],
"mappings": ";;AAAA,6BAA6B,CAAC,MAAM;AACpC,uCAAkG;AAClG,uCAAiF;AAGjF;;;GAGG;AACH;IA4CE,6BAAY,iBAAoC;QA3BhD,uBAAuB;QACf,kBAAa,GAAe,EAAE,CAAC;QA2BrC,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAM,GAAG,GAAG,UAAG,CAAC,iBAAiB,CAAC,CAAC;QACnC,2BAAoB,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IACvD,CAAC;IA5BD;;;;;;;;;;;OAWG;IACI,gDAA4B,GAAnC,UAAoC,MAAgB;QAClD,IAAM,QAAQ,GAAc,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAElE,QAAQ,CAAC,MAAM,GAAG,UAAC,CAAM;YACvB,OAAA,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,UAAA,CAAC,IAAI,OAAA,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAA9B,CAA8B,CAAC,CAAC,CAAC,CAAC,CAAC;QAApF,CAAoF,CAAC;QAEvF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ClD,IAAI,OAAO;YAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACtC,IAAI,KAAK;YAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED,8CAAgB,GAAhB,UAAiB,UAAU,EAAE,SAA2B,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAuB;QAArG,iBAcC;QAbC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,sFAAsF;QACtF,UAAU,CAAC,GAAG,CAAC,wBAAwB,EAAE,UAAA,GAAG,IAAI,OAAA,KAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAA,EAAE,IAAI,OAAA,EAAE,CAAC,GAAG,CAAC,EAAP,CAAO,CAAC,EAAzC,CAAyC,CAAC,CAAC;QAC3F,IAAM,IAAI,GAAG,UAAG,CAAC,SAAS,CAAC,CAAC;QAE5B,oDAAoD;QACpD,2BAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9E,mDAAmD;QACnD,2BAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;IACH,0BAAC;AAAD,CAAC,AAvFD,IAuFC;AAvFY,kDAAmB",
"sourcesContent": [
"/** @publicapi @module ng1 */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType, isDefined } from '@uirouter/core';\nimport { val, createProxyFunctions, removeFrom, isObject } from '@uirouter/core';\nimport { ILocationService, ILocationProvider, IWindowService } from 'angular';\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n * @internalapi\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n private $locationProvider: ILocationProvider;\n private $location: ILocationService;\n private $sniffer: any;\n private $browser: any;\n private $window: IWindowService;\n\n path;\n search;\n hash;\n hashPrefix;\n port;\n protocol;\n host;\n\n private _baseHref: string;\n\n // .onChange() registry\n private _urlListeners: Function[] = [];\n\n /**\n * Applys ng1-specific path parameter encoding\n *\n * The Angular 1 `$location` service is a bit weird.\n * It doesn't allow slashes to be encoded/decoded bi-directionally.\n *\n * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n *\n * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n *\n * @param router\n */\n static monkeyPatchPathParameterType(router: UIRouter) {\n const pathType: ParamType = router.urlMatcherFactory.type('path');\n\n pathType.encode = (x: any) =>\n x != null ? x.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : x;\n\n pathType.decode = (x: string) =>\n x != null ? x.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : x;\n }\n\n dispose() {}\n\n constructor($locationProvider: ILocationProvider) {\n this.$locationProvider = $locationProvider;\n const _lp = val($locationProvider);\n createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n }\n\n onChange(callback: Function) {\n this._urlListeners.push(callback);\n return () => removeFrom(this._urlListeners)(callback);\n }\n\n html5Mode() {\n let html5Mode: any = this.$locationProvider.html5Mode();\n html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n return html5Mode && this.$sniffer.history;\n }\n\n baseHref() {\n return this._baseHref || (this._baseHref = this.$browser.baseHref() || this.$window.location.pathname);\n }\n\n url(newUrl?: string, replace = false, state?) {\n if (isDefined(newUrl)) this.$location.url(newUrl);\n if (replace) this.$location.replace();\n if (state) this.$location.state(state);\n return this.$location.url();\n }\n\n _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser, $window: IWindowService) {\n this.$location = $location;\n this.$sniffer = $sniffer;\n this.$browser = $browser;\n this.$window = $window;\n\n // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n $rootScope.$on('$locationChangeSuccess', evt => this._urlListeners.forEach(fn => fn(evt)));\n const _loc = val($location);\n\n // Bind these LocationService functions to $location\n createProxyFunctions(_loc, this, _loc, ['replace', 'path', 'search', 'hash']);\n // Bind these LocationConfig functions to $location\n createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n }\n}\n"
]
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment