ember.js - Emberjs router with partially interpreted route -


i want create similar stackoverflow has share button: want create short link shares. link can take following 3 forms:

s/51b9dd49065f905411000000/1 s/51b9dd49065f905411000000/51b9dd49065f905411000020/2 s/51b9dd49065f905411000000/51b9dd49065f905411000020/51b9dd49065f905611000020/3 

how can make ember interpret route until s/ give me rest argument can process , reconstruct proper route?

you can use star segments. documented here

given application:

app.router.map(function() {     this.route('share', { path: 's/*linkpath' }) });  app.shareroute = ember.route.extend({   model: function(params) {         console.log(params.linkpath);     return params;   } }); 

when url begins s/ , ends anything. remaining value setup in variable called linkpath.

for example:

url                          => params.linkpath content     ------------------------------------------------------------- s/51b9dd49065f905411000000/1 => "51b9dd49065f905411000000/1" s/hey/ho/lets/go             => "hey/ho/lets/go" 

so in model hook, can rest of arguments, using params.linkpath.

you can see in action in jsbin http://jsbin.com/orehaso/3/#/s/51b9dd490/51b9dd490/3. open console , se string "51b9dd490/51b9dd490/3" logged.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -