I introduced an issue into the next version of my app and for the life of me I can't see what it is.
I have an ng-repeat
that lists several options, each option has a button to display the option info in greater detail. Each option has a button with a link like this:
ng-click="$location.url('/tab/clubs/L_1001_1001_1001')"
In my controller I am assigning the imported $location
to: $scope.$location = $location ;
But the moment I click the link I get the following error:
ionic.bundle.js:20306 Error: [$parse:ueoe] Unexpected end of expression: club. http://errors.angularjs.org/1.3.13/$parse/ueoe?p0=club.
at ionic.bundle.js:8762 at Parser.consume (ionic.bundle.js:20747) at Parser.identifier (ionic.bundle.js:20778) at Parser.fieldAccess (ionic.bundle.js:20975) at Parser.primary (ionic.bundle.js:20701) at Parser.unary (ionic.bundle.js:20970) at Parser.multiplicative (ionic.bundle.js:20953) at Parser.additive (ionic.bundle.js:20944) at Parser.relational (ionic.bundle.js:20935) at Parser.equality (ionic.bundle.js:20926)
How can I trace what is throwing this error? Obviously, its related to club.
somehow - but I can't tell what. The error implies I am missing an ending bracket or curly bracket but I ran external tools to check all my syntax and everything looks good.
The above link is called from tab-clubs.html
(controller: ClubCtrl) - that entire page renders fine and tracks no issues. The link calls a specific controller/template using the state:
.state('tab.clubs', {
cache: true,
url: '/clubs',
params: {
'refreshClubs' : 0,
'pushAction' : 0,
'pushSub' : null,
'pushMsg' : null,
'pushCode' : null
},
views: {
'tab-clubs': {
templateUrl: 'templates/tab-clubs.html',
controller: 'ClubCtrl'
}
}
})
.state('tab.club-detail', {
url: '/clubs/:ceID',
views: {
'tab-clubs': {
templateUrl: 'templates/detail-clubs.html',
controller: 'ClubDetailCtrl'
}
}
})
...and inside ClubDetailCtrl
I added some basic console.log("Here")
messages just to see if its making into the controller and it appears it is not. So it seems to be choking somewhere between clicking the link and calling the controller.
update:
So I moved the $location.url(...) to a controller function and recoded the template to:
ng-click="goUrl('L_' +event.cID+ '_' +event.clID+ '_' +event.ceID);"
And in the controller now have:
$scope.goUrl = function(id) {
console.log("A: " +id) ;
$location.url("/tab/clubs/" +id) ;
console.log("B: " +id) ;
}
The ng-click is firing and getting into the controller function, both console.log A
and B
are displaying - but still getting the same error. I then add test console.log()
code in the next controller and the tests console log messages never trigger - so its not even making into the controller.
How else can I track this?