DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
    • can-component
    • can-compute
    • can-connect
    • can-define
    • can-define/list/list
    • can-define/map/map
    • can-route
      • static
        • current
        • data
        • deparam
        • link
        • matched
        • param
        • ready
        • url
    • can-route-pushstate
    • can-set
    • can-stache
    • can-stache/helpers/route
    • can-stache-bindings
  • Ecosystem
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Core
  • /
  • can-route
  • /
  • param
  • / On this page
    • param

      function

      Get a route path from given data.

      • source

      route.param(data)

      Parameters

      1. object {data}:

        The data to populate the route with.

      Returns

      {String}:

      The route, with the data populated in it.

      Parameterizes the raw JS object representation provided in data.

      route.param({ type: "video", id: 5 });
        // -> "type=video&id=5"
      

      If a route matching the provided data is found, that URL is built from the data. Any remaining data is added at the end of the URL as & separated key/value parameters.

      route("{type}/{id}");
      
      route.param({ type: "video", id: 5 }) // -> "video/5"
      route.param({ type: "video", id: 5, isNew: false })
        // -> "video/5&isNew=false"
      

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.