I'm afraid this question is pretty stupid....
Using the {{current.name}} syntax I can show the name of $scope.current in the view. I set current when I switch from the list view (/mythings) to editing an item (/mythings?id=someId).
Actually this is redundant as I have the information both in the $location and in $scope.current. This redundancy makes it more complicated to understand, so I'd like to get rid of it.
I replaced current by a current item returning function and hoped it would work (like it does in many other cases). But it doesn't, I need to write {{current().name}} everywhere, which I tend to forget.
Maybe I'm doing it all wrong? I'm a beginner here.
Is there a way to make it work? Somehow bless current so it always gets evaluated before use?
/mythings, what is it you want to see bound to the screen?/mythings, then there's nothing as there's no selected item (currentis undefined). When I'm on/mythings?id=someId, thencurrent.id = someId. This is the redundancy I wrote about. I could imaginecurrentbeing a function returning the element with$location.search('id').current) to some value that already exists or you have to declare a new function (current()) and call it multiple times per digest loop. I think the second alternative introduces more redundancy than it avoids.$location.searchwhile the function would always produce the correct result. I was trying to remember if the last state of a page was "list" or "detail" by storingcurrentin a service and it got out of sync with the location (no surprise). Then I tried to update the$location.searchbased oncurrentand got lost. Maybe I just need a break... ;)