Problem with ui-sref

0

I'm having trouble doing a POST using ui-sref. I need to call a controller by passing an ID where it will return me the data recorded in the database. It works fine when I use the route, but when I use ui.route I'm having a problem.

With ngRouter

.when("/highways/:id",
        {
            templateUrl: "assets/templates/highway/edit.html",
            controller: "HighwayController",
            controllerAs: "ctrl"
        })

With ui.router

.state('highways.id', {
        url: '/:id',
        templateUrl: 'assets/templates/highway/edit.html',
        controller: 'HighwayController as ctrl'


    })

Calling in html

<tr ng-repeat="hw in ctrl.search.results" ui-sref="highways.id(hw)">
    <!--ng-click="ctrl.search.redirectToItem(hw)"-->

This ng-click is the call that was working before using ui.router.

    
asked by anonymous 26.10.2015 / 18:22

1 answer

2

Please try the following:

<tr ng-repeat="hw in ctrl.search.results" ui-sref="highways.id({id: hw})">
    
27.10.2015 / 13:24