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

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -