# $generatePath

## Introduction

`$generatePath(string routeName, Object params = {}) : string`

The **$generatePath** instance method makes it possible to [generate](https://docs.elentra.org/ejs/1.4/guide/routing/path-generation) the absolute path to any [route](https://docs.elentra.org/ejs/1.4/guide/routing/routes) using its name and [parameters](https://docs.elentra.org/ejs/1.4/routing/routes#parameters).  Using this method ensures all links are automatically updated whenever a route is changed.

Alternatively, you may use a [view link](https://docs.elentra.org/ejs/1.4/guide/routing/view-links) within your component templates to generate routes declaratively.
