Huỳnh Tú
Huỳnh Tú

Reputation: 375

How can i change route url in CanJS

I have route.attr:

can.route.attr({type:"list",id:"list",val:""})

location.hash -> "#!update/edit&val=113"

how can I change this to #!list/list and destroy val:"" in url

i use this : can.route.attr({type:"list",id:"list",val:null})

location.hash -> "#!update/edit&val="

Upvotes: 0

Views: 116

Answers (1)

air_hadoken
air_hadoken

Reputation: 611

Much like other can.Maps, completely removing a key from can.route requires using can.route.removeAttr("val"). Try it; you should see &val= disappear from the hash entirely.

Upvotes: 1

Related Questions