@@ -18,9 +18,107 @@ import { shallowEqual } from '../utils';
18
18
@category ember-routing-router-service
19
19
*/
20
20
const RouterService = Service . extend ( {
21
+
22
+ /**
23
+ Name of the current route.
24
+
25
+ This property represent the logical name of the route,
26
+ which is comma separated.
27
+ For the following router:
28
+
29
+ ```app/router.js
30
+ Router.map(function() {
31
+ this.route('about);
32
+ this.route('blog', function () {
33
+ this.route('post', { path: ':post_id' });
34
+ });
35
+ });
36
+ ```
37
+
38
+ It will return:
39
+
40
+ * `index` when you visit `/`
41
+ * `about` when you visit `/about`
42
+ * `blog.index` when you visit `/blog`
43
+ * `blog.post` when you visit `/blog/some-post-id`
44
+
45
+ @property currentRouteName
46
+ @type String
47
+ @public
48
+ */
21
49
currentRouteName : readOnly ( '_router.currentRouteName' ) ,
50
+
51
+ /**
52
+ Current URL for the application.
53
+
54
+ This property represent the URL path for this route.
55
+ For the following router:
56
+
57
+ ```app/router.js
58
+ Router.map(function() {
59
+ this.route('about);
60
+ this.route('blog', function () {
61
+ this.route('post', { path: ':post_id' });
62
+ });
63
+ });
64
+ ```
65
+
66
+ It will return:
67
+
68
+ * `/` when you visit `/`
69
+ * `/about` when you visit `/about`
70
+ * `/blog/index` when you visit `/blog`
71
+ * `/blog/post` when you visit `/blog/some-post-id`
72
+
73
+ @property currentURL
74
+ @type String
75
+ @public
76
+ */
22
77
currentURL : readOnly ( '_router.currentURL' ) ,
78
+
79
+ /**
80
+ The `location` property determines the type of URL's that your
81
+ application will use.
82
+ The following location types are currently available:
83
+ * `auto`
84
+ * `hash`
85
+ * `history`
86
+ * `none`
87
+
88
+ @property location
89
+ @default 'hash'
90
+ @see {Ember.Location}
91
+ @public
92
+ */
23
93
location : readOnly ( '_router.location' ) ,
94
+
95
+ /**
96
+ The `rootURL` property represents the URL of the root of
97
+ the application, '/' by default.
98
+ This prefix is assumed on all routes defined on this app.
99
+
100
+ IF you change the `rootURL` in your environment configuration
101
+ like so:
102
+
103
+ ```config/environment.js
104
+ 'use strict';
105
+
106
+ module.exports = function(environment) {
107
+ let ENV = {
108
+ modulePrefix: 'router-service',
109
+ environment,
110
+ rootURL: '/my-root',
111
+ …
112
+ }
113
+ ]
114
+ ```
115
+
116
+ This property will return `/my-root`.
117
+
118
+ @property rootURL
119
+ @default '/'
120
+ @public
121
+ */
24
122
rootURL : readOnly ( '_router.rootURL' ) ,
25
123
_router : null ,
26
124
0 commit comments