Error when populating the url dynamically

Hi all,

I am using the below code for generating dynamic side bar menus. The menu text works fine. But On the click link (ng-click), I am getting some error which I could not fix.

Below is the HTML code.

< ion-list ng-repeat=“menu in menuData”>
< ion-item nav-clear menu-close ng-click="#/app/{{menu}}">
< /ion-item>
< ion-list>

Below is the error that I get. The values are populated as app/blogs but I get error.

Error: [$parse:syntax] Syntax Error: Token ‘app’ is an unexpected token at column 2 of the expression [/app/blogs] starting at [app/blogs].

ng-click requires a function on a scrope something like this:

$scope.navigate = function (page) {

<ion-item ng-click="navigate('/app/' + menu)"></ion-item>

In other cases you can use ng-href or ui-sref of ui-router to navigate directly to another state in your template:

1 Like

Thanks for the response. It works as required.

Sorry for late response on this.