0

I am new in angular js.

In view i have a list of products, I have to open the detail of the product when i clicked on that. I have to pass 2 parameters to my 'productdetails' controller.

enter image description here

3
  • Can you show your code? Commented Apr 16, 2017 at 6:44
  • yes, i can update the question. Commented Apr 16, 2017 at 6:45
  • I have updated the tag hence this is Ionic 1 question.Not an Ionic 2. Commented Apr 16, 2017 at 6:52

1 Answer 1

3

You miss use angular interpolation (double curly brackets), Also try not to have much functionality in the view code, this should be in the controller / dedicated service. See code example below


View (html)

<a ng-click="GetLiveStatus(item)">   


controller (js)

function LiveStatusController($location) {
    $scope.GetLiveStatus = function(item){
        // Your code here ...

        // nav part
        $location.path(<'your path string here'>, {<your path params here>});
    }
}

Sign up to request clarification or add additional context in comments.

2 Comments

can i redirect to any another view from the controller ?
Yes you can! If you're using the regular angular router module ngRoute for defining the app's routes you can simply inject the $location service to your controller and use it in the bounded function. In a smiliar way you can use the third party module ui-router to do the same only this time use the $state service for it. See my updated code example.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.