0

I'm trying to use angular js ui router to route my page.

Here's the code that I've written:

<a  ui-sref="transporterEditDetails({companyId:  '{{d.companyId}}' )"  style="cursor: pointer">{{d.companyName}}</a>

Here's the js code :

var routerApp = angular.module('routerApp', ['ui.router','ui.bootstrap','xeditable','google.places','angular-loading-bar','ui.select','angularUtils.directives.dirPagination','notificationsTruckway','ui.tinymce'])
routerApp.config(function($stateProvider, $urlRouterProvider,cfpLoadingBarProvider) {
 $stateProvider
        .state('transporterEditDetails', {
        url: '/transporterEditDetails/:companyId',
        controller:'TransporterEditDetailsController',
        templateUrl: 'Transporter-editDetails.html'
    })
routerApp.controller('TransporterEditDetailsController', function($scope,$location,$http,usersFactory,$stateParams) {
$scope.companyId = $stateParams.companyId;
}

I don't know what's wrong in my code, I'm unable to get the href attribute which should be generated automatically.

2 Answers 2

1

Did you try without quotes and parentheses

<a  ui-sref="transporterEditDetails({companyId:  d.companyId})"  style="cursor: pointer">{{d.companyName}}</a>
Sign up to request clarification or add additional context in comments.

1 Comment

I see, I'll remove the quotes and parentheses and check if its working.
1

You don't need to use {{}}(interpolation) inside ui-sref. Also remove '(wrapped single quote)

ui-sref="transporterEditDetails({companyId:  d.companyId })"

1 Comment

I'll give it a try.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.