def url_for(params)
      host_with_port = host || location.host
      host_with_port += ":#{port}" if port && port != 80
      scheme = scheme || location.scheme

      unless RUBY_PLATFORM == 'opal'
        # lazy load routes and views on the server
        if !@router && @routes_loader
          # Load the templates
          @routes_loader.call
        end
      end

      path, params = @router.params_to_url(params)

      if path == nil
        raise "No route matched, make sure you have the base route defined last: `client '/', {}`"
      end

      new_url    = "#{scheme}://#{host_with_port}#{path.chomp('/')}"

      # Add query params
      params_str = ''
      unless params.empty?
        query_parts = []
        nested_params_hash(params).each_pair do |key, value|
          # remove the _ from the front
          value = Volt::Parsing.encodeURI(value)
          query_parts << "#{key}=#{value}"
        end

        if query_parts.size > 0
          query = query_parts.join('&')
          new_url += "?#{query}"
        end
      end

      # Add fragment
      frag    = fragment
      new_url += '#' + frag if frag.present?

      new_url
    end
def url_for(params)
      host_with_port = host || location.host
      host_with_port += ":#{port}" if port && port != 80
      scheme = scheme || location.scheme

      unless RUBY_PLATFORM == 'opal'
        # lazy load routes and views on the server
        if !@router && @routes_loader
          # Load the templates
          @routes_loader.call
        end
      end

      path, params = @router.params_to_url(params)

      if path == nil
        raise "No route matched, make sure you have the base route defined last: `client '/', {}`"
      end

      new_url    = "#{scheme}://#{host_with_port}#{path.chomp('/')}"

      # Add query params
      params_str = ''
      unless params.empty?
        query_parts = []
        nested_params_hash(params).each_pair do |key, value|
          # remove the _ from the front
          value = Volt::Parsing.encodeURI(value)
          query_parts << "#{key}=#{value}"
        end

        if query_parts.size > 0
          query = query_parts.join('&')
          new_url += "?#{query}"
        end
      end

      # Add fragment
      frag    = fragment
      new_url += '#' + frag if frag.present?

      new_url
    end
Full url rebuilds the url from it's constituent parts.
 The params passed in are used to generate the urls.