javascript - Angular js - optional dynamic url params -


I have set up a simple paging URL like this:

 . When ('/ Users:: offset /: filter /: keyword', {templateUrl: 'views / users / index.html', administrator: 'user', reloadon search: folley}). Otherwise ({redirectTo: '/'});   

Now if I browse site.co/users/5/1/heykeyword

but if I site I was redirected to .CO / User / 5/1 me /

What's wrong?

Should not the roads be moving?!!

The problem is whether you have written, a required argument is included,

You can get it optional by adding 'keyword' (by adding a question mark):

 . When ('/ user /: offset /: filter /: keyword?', {TemplateUrl: 'views / users / index.html', administrator: 'user', reloadon search: folley}). Otherwise ({redirectTo: '/'}); Offset & amp;   

A filter is required, but the keyword parameter is now optional.

For more information: $ pathProvider

From the angularjs document:

The path can be optional in the named group with a question mark: eg : Name.

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -