Witam,
mam problem z przekazywaniem parametrów do widoku UI-router. Użytkownik może kliknąć pozycję na liście w widoku app.inboxallusers, i to ma przełączyć go na widok konkretnego użytkownika app.inboxselecteduser. W tym celu chcę przekazać do tego drugiego widoku parametr. Niestety występuje błąd. Co robię źle?
Plik app.js:
.state('app.inboxallusers', {
cache: false,
url: '/inboxallusers',
controller: 'Inbox2Controller',
templateUrl: "InboxAllUsers.html"
})
.state('app.inboxselecteduser', {
cache: false,
url: '/inboxselecteduser/:PassedID',
controller: 'Inbox2Controller',
templateUrl: "Inbox-SelectedUser.html"
})
starter.controller('Inbox2Controller', ['$scope', '$http', '$rootScope', '$ionicHistory', '$state', '$ionicViewSwitcher', '$stateParams', function ($scope, $http, $rootScope, $ionicHistory, $state, $ionicViewSwitcher, $stateParams) {
$scope.PassedID = $stateParams.PassedID;
}]);
Plik InboxAllUsers.html:
Taki kod działa, ale nie przekazuje parametru:
<a ui-sref="app.inboxselecteduser">
A taki kod przekazujący parametr generuje błąd:
<a ui-sref="app.inboxselecteduser{{PassedID: 63}}">
Opis błędu:
Error: [$parse:syntax] Syntax Error: Token ':' is an unexpected token at column 9 of the expression [PassedID: 63] starting at [: 63].
http://errors.angularjs.org/1.5.3/$parse/syntax?p0=%3A&p1=is%20an%20unexpected%20token&p2=9&p3=PassedID%3A%2063&p4=%3A%2063
at http://localhost:4400/lib/ionic/js/ionic.bundle.js:13438:12
at AST.throwError (http://localhost:4400/lib/ionic/js/ionic.bundle.js:27376:11)
at AST.ast (http://localhost:4400/lib/ionic/js/ionic.bundle.js:27144:12)
at ASTCompiler.compile (http://localhost:4400/lib/ionic/js/ionic.bundle.js:27592:31)
at Parser.parse (http://localhost:4400/lib/ionic/js/ionic.bundle.js:28479:29)
at $parse (http://localhost:4400/lib/ionic/js/ionic.bundle.js:28610:39)
at $interpolate (http://localhost:4400/lib/ionic/js/ionic.bundle.js:25328:25)
at addAttrInterpolateDirective (http://localhost:4400/lib/ionic/js/ionic.bundle.js:22842:27)
at collectDirectives (http://localhost:4400/lib/ionic/js/ionic.bundle.js:21797:13)
at compileNodes (http://localhost:4400/lib/ionic/js/ionic.bundle.js:21622:22) <ion-nav-view class="pane view-container" state="app.inboxallusers" nav-view="stage" style="transform: translate3d(99%, 0px, 0px); opacity: 1;" nav-view-transition="android">