Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit a6166ff

Browse files
committed
docs(1.x): use static property form config
1 parent 6d51f49 commit a6166ff

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

docs/content/configuration.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ This guide shows the many ways to map URLs to components.
55
A router takes an array of pairings like this:
66

77
```js
8-
$router.config([
8+
MyController.$routeConfig = [
99
{ path: '/user', component: 'user' }
10-
]);
10+
];
1111
```
1212

1313
## Sibling Viewports
1414

1515
You can configure multiple viewports on the same path like this:
1616

1717
```js
18-
$router.config([
18+
MyController.$routeConfig = [
1919
{ path: '/user',
2020
components: {
2121
master: 'userList',
2222
detail: 'user'
2323
} }
24-
]);
24+
];
2525
```
2626

2727
```html
@@ -36,10 +36,10 @@ Useful for migrating to a new URL scheme and setting up default routes.
3636
With the following configuration:
3737

3838
```js
39-
$router.config([
39+
MyController.$routeConfig = [
4040
{ path: '/', redirectTo: '/user' },
4141
{ path: '/user', component: 'user' }
42-
]);
42+
];
4343
```
4444

4545
A navigation to `/` will result in the URL changing to `/user` and the viewport at that level loading the `user` component.

docs/content/getting-started.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,10 @@ So how do we configure the app? Let's open `app.js` and find out. Add this to th
6767
angular.module('app', ['ngNewRouter'])
6868
.controller('AppController', ['$router', AppController]);
6969

70-
function AppController ($router) {
71-
$router.config([
72-
{path: '/', component: 'home' }
73-
]);
74-
}
70+
AppController.$routeConfig([
71+
{path: '/', component: 'home' }
72+
]);
73+
function AppController ($router) {}
7574
```
7675

7776
The `ngNewRouter` module provides a new service, `$router`. You notice in the configuration that
@@ -149,12 +148,11 @@ In app.js:
149148
angular.module('app', ['ngNewRouter'])
150149
.controller('AppController', ['$router', AppController]);
151150

152-
function AppController ($router) {
153-
$router.config([
154-
{ path: '/', component: 'home' },
155-
{ path: '/detail/:id', component: 'detail' }
156-
]);
157-
}
151+
AppController.$routeConfig = [
152+
{ path: '/', component: 'home' },
153+
{ path: '/detail/:id', component: 'detail' }
154+
];
155+
function AppController ($router) {}
158156
```
159157

160158
We can link to our `detail` component using the `ng-link` directive.

0 commit comments

Comments
 (0)