5
5
* @license MIT License http://opensource.org/licenses/MIT
6
6
*/
7
7
'use strict' ;
8
-
9
8
( function ( angular ) {
10
9
11
10
/**
12
11
* @ngdoc module
13
12
* @module route-segment
14
13
* @name route-segment
14
+ * @packageName angular-route-segment
15
15
* @requires ngRoute
16
16
* @description
17
17
* This library is intended to provide the lacking functionality of nested routing to [AngularJS](http://angularjs.org) applications.
@@ -167,7 +167,6 @@ mod.provider( '$routeSegment',
167
167
* @ngdoc type
168
168
* @module route-segment
169
169
* @name $routeSegmentProvider.Pointer
170
- * @protected
171
170
* @description Segment traversal element.
172
171
*
173
172
* Each {@link $routeSegmentProvider#segment $routeSegmentProvider#segment} call creates new navigation pointer
@@ -189,26 +188,23 @@ mod.provider( '$routeSegment',
189
188
/**
190
189
* @ngdoc method
191
190
* @name $routeSegmentProvider.Pointer#segment
192
- * @param {String } name Name of a segment.
191
+ * @param {string } name Name of a segment.
193
192
* @param {Object } params Segment's parameters hash. The following params are supported:
194
- * - `template` {String|Function} provides HTML for the given segment view;
195
- * - `templateUrl` {String|Function} is a template should be fetched from network via this URL;
196
- * - `controller` {String|Function} is attached to the given segment view when compiled and linked,
193
+ * @param {String|Function } [params.template] provides HTML for the given segment view;
194
+ * @param {String|Function } [params.templateUrl] template to fetch from network via this URL;
195
+ * @param {String|Function } [params.controller] cotroller attached to the given segment view when compiled and linked,
197
196
* this can be any controller definition AngularJS supports;
198
- * - `controllerAs` {String} is a controller alias name, if present the controller will be
197
+ * @param {String } [params.controllerAs] controller alias name, if present the controller will be
199
198
* published to scope under the controllerAs name
200
- * - `dependencies` {String[]} is an array of route param names which are forcing the view
201
- * to recreate when changed;
202
- * - `watcher` {Sunction} is a $watch-function for recreating the view when its returning value
203
- * is changed;
204
- * - `resolve` {Object<String, Function>} is a hash of functions or injectable names which should be resolved
199
+ * @param {Array<String> } [params.dependencies] array of route param names which are forcing the view to recreate when changed;
200
+ * @param {Function } [params.watcher] $watch-function for recreating the view when its returning value is changed;
201
+ * @param {Object<String, Function> } resolve hash of functions or injectable names which should be resolved
205
202
* prior to instantiating the template and the controller;
206
- * - `untilResolved` {Object} is the alternate set of params (e.g. `template` and `controller`)
203
+ * @param {Object } [params.untilResolved] alternate set of params (e.g. `template` and `controller`)
207
204
* which should be used before resolving is completed;
208
- * - `resolveFailed` {Object} is the alternate set of params which should be used
209
- * if resolving failed;
210
- * - `default` {Boolean} is a boolean value which can be set to true if this child segment should be
211
- * loaded by default when no child is specified in the route.
205
+ * @param {Object } [params.resolveFailed] alternate set of params which should be used if resolving failed;
206
+ * @param {Boolean } [params.default] when set to true this child segment should be loaded by
207
+ * default when no child is specified in the route.
212
208
* @returns {$routeSegmentProvider.Pointer } The same level pointer.
213
209
* @description Adds new segment at current pointer level.
214
210
*
@@ -229,7 +225,7 @@ mod.provider( '$routeSegment',
229
225
* @name $routeSegmentProvider.Pointer#within
230
226
* @param {String= } childName An existing segment's name. If undefined, then the last added segment is selected.
231
227
* @returns {$routeSegmentProvider.Pointer } The pointer to the child segment.
232
- * @throws {Error } when {@link $routeSegmentProvider#strictDi $routeSegmentProvider#strictDi } is true and segment with given name is not found
228
+ * @throws {Error } when {@link $routeSegmentProvider.options#strictMode $routeSegmentProvider.options#strictMode } is true and segment with given name is not found
233
229
* @description Traverses into an existing segment, so that subsequent `segment` calls
234
230
* will add new segments as its descendants.
235
231
*/
@@ -337,7 +333,7 @@ mod.provider( '$routeSegment',
337
333
/**
338
334
* @ngdoc property
339
335
* @name $routeSegment#chain
340
- * @type {Array<$routeSegment.Segment> }
336
+ * @type {Array. <$routeSegment.Segment> }
341
337
* @description Array of segments splitted by each level separately. Each item contains the following properties:
342
338
*
343
339
* - `name` is the name of a segment;
@@ -584,7 +580,6 @@ mod.provider( '$routeSegment',
584
580
* @ngdoc type
585
581
* @module route-segment
586
582
* @name $routeSegment.Segment
587
- * @protected
588
583
* @description Segment record
589
584
*/
590
585
$routeSegment . chain [ index ] = {
@@ -612,7 +607,7 @@ mod.provider( '$routeSegment',
612
607
/**
613
608
* @ngdoc method
614
609
* @name $routeSegment.Segment#reload
615
- * @description reloads current segment from scratc
610
+ * @description reloads current segment from scratch
616
611
*/
617
612
reload : function ( ) {
618
613
var originalSegment = getSegmentInChain ( index , $routeSegment . name . split ( "." ) ) ;
@@ -723,6 +718,7 @@ mod.provider( '$routeSegment',
723
718
* @name routeSegmentUrl
724
719
* @param {String } name fully qualified segment name
725
720
* @param {Object } params params to resolve segment
721
+ * @returns {string } given url
726
722
* @description Returns url for a given segment
727
723
*
728
724
* Usage:
@@ -740,8 +736,17 @@ mod.filter('routeSegmentUrl', ['$routeSegment', function($routeSegment) {
740
736
} ] ) ;
741
737
742
738
/**
739
+ * @ngdoc filter
740
+ * @module route-segment
741
+ * @name routeSegmentEqualsTo
742
+ * @param {String } name fully qualified segment name
743
+ * @returns {boolean } true if given segment name is the active one
744
+ * @description Check whether active segment equals to the given segment name
745
+ *
743
746
* Usage:
747
+ * ```html
744
748
* <li ng-class="{active: ('index.list' | routeSegmentEqualsTo)}">
749
+ * ```
745
750
*/
746
751
mod . filter ( 'routeSegmentEqualsTo' , [ '$routeSegment' , function ( $routeSegment ) {
747
752
var filter = function ( value ) {
@@ -752,8 +757,17 @@ mod.filter('routeSegmentEqualsTo', ['$routeSegment', function($routeSegment) {
752
757
} ] ) ;
753
758
754
759
/**
760
+ * @ngdoc filter
761
+ * @module route-segment
762
+ * @name routeSegmentStartsWith
763
+ * @param {String } name segment name
764
+ * @returns {boolean } true if active segment name begins with given name
765
+ * @description Check whether active segment starts with the given segment name
766
+ *
755
767
* Usage:
768
+ * ```html
756
769
* <li ng-class="{active: ('section1' | routeSegmentStartsWith)}">
770
+ * ```
757
771
*/
758
772
mod . filter ( 'routeSegmentStartsWith' , [ '$routeSegment' , function ( $routeSegment ) {
759
773
var filter = function ( value ) {
@@ -764,8 +778,17 @@ mod.filter('routeSegmentStartsWith', ['$routeSegment', function($routeSegment) {
764
778
} ] ) ;
765
779
766
780
/**
781
+ * @ngdoc filter
782
+ * @module route-segment
783
+ * @name routeSegmentContains
784
+ * @param {String } name segment name
785
+ * @returns {boolean } true if active segment contains given name
786
+ * @description Check whether active segment contains the given segment name
787
+ *
767
788
* Usage:
789
+ * ```html
768
790
* <li ng-class="{active: ('itemInfo' | routeSegmentContains)}">
791
+ * ```
769
792
*/
770
793
mod . filter ( 'routeSegmentContains' , [ '$routeSegment' , function ( $routeSegment ) {
771
794
var filter = function ( value ) {
@@ -776,8 +799,17 @@ mod.filter('routeSegmentContains', ['$routeSegment', function($routeSegment) {
776
799
} ] ) ;
777
800
778
801
/**
802
+ * @ngdoc filter
803
+ * @module route-segment
804
+ * @name routeSegmentParam
805
+ * @param {String } name param name
806
+ * @returns {string|undefined } param value or undefined
807
+ * @description Returns segment parameter by name
808
+ *
779
809
* Usage:
810
+ * ```html
780
811
* <li ng-class="{active: ('index.list.itemInfo' | routeSegmentEqualsTo) && ('id' | routeSegmentParam) == 123}">
812
+ * ```
781
813
*/
782
814
mod . filter ( 'routeSegmentParam' , [ '$routeSegment' , function ( $routeSegment ) {
783
815
var filter = function ( value ) {
@@ -788,4 +820,4 @@ mod.filter('routeSegmentParam', ['$routeSegment', function($routeSegment) {
788
820
} ] ) ;
789
821
790
822
791
- } ) ( angular ) ;
823
+ } ) ( angular ) ;
0 commit comments