Ng-href and dynamic links


#1

Hello to everyone,

I need to create a list with 2 different link, this is a bit of my code:

<ion-item ng-repeat="item in items" class="item-remove-animate" ng-href="{{(!item.usoInterno) ? '#/tab/postazioni/{{item.codice}}' : '#/tab/collaboratori'}}">

But when I execute the application, it returns an error like:

ionic.bundle.js:25642 Error: [$parse:lexerr] Lexer Error: Unterminated quote at columns 21-52 ['#/tab/postazioni/{{item.codice] in expression [(!item.usoInterno) ? '#/tab/postazioni/{{item.codice].
http://errors.angularjs.org/1.4.3/$parse/lexerr?p0=Unterminated%20quote&p1=…&p2=(!item.usoInterno)%20%3F%20'%23%2Ftab%2Fpostazioni%2F%7B%7Bitem.codice
    at http://localhost:8100/lib/ionic/js/ionic.bundle.js:13380:12
    at Lexer.throwError (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25836:11)
    at Lexer.readString (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25927:10)
    at Lexer.lex (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25774:14)
    at Object.AST.ast (http://localhost:8100/lib/ionic/js/ionic.bundle.js:25958:30)
    at Object.ASTCompiler.compile (http://localhost:8100/lib/ionic/js/ionic.bundle.js:26412:31)
    at Parser.parse (http://localhost:8100/lib/ionic/js/ionic.bundle.js:27261:29)
    at $parse (http://localhost:8100/lib/ionic/js/ionic.bundle.js:27385:39)
    at $interpolate (http://localhost:8100/lib/ionic/js/ionic.bundle.js:24124:25)
    at addAttrInterpolateDirective (http://localhost:8100/lib/ionic/js/ionic.bundle.js:21803:27) <ion-nav-view name="tab-comanda" class="view-container tab-content disable-user-behavior" nav-view="active" nav-view-transition="ios">

Could you please explain me where is the mistake?

Thank you in advance.


#2

Ok,

I solved by my self with the following correction:

<ion-item ng-repeat="item in items" class="item-remove-animate" ng-href="{{!item.usoInterno ? '#/tab/postazioni/' + item.codice : '#/tab/collaboratori'}}">

Thank you

Samuele