J
J
jenya77712016-08-11 14:25:07
Angular
jenya7771, 2016-08-11 14:25:07

Link not generated from id?

Why does clicking on a link go to the main page?
But when you enter the address adres/#/detaileddis:%7B%7Binfo.id%7D%7D into the address bar, everything works and goes to the desired page.

var myApp = angular.module('myApp', ["ngRoute"])

    myApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){

          $routeProvider.when('/', {
            templateUrl:'template/home.php',
            controller:'homeCtrl'
          });

      $routeProvider.when('/detaileddis:{{info.id}}', {
        templateUrl:'template/detaileddis.php',
        controller:'detaileddisCtrl'
      });

          $routeProvider.otherwise({redirectTo: '/'});
}]);

<td><a data-ng-href="#/detaileddis:{{info.id}}">{{info.id}}</a></td>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Arushanov, 2016-08-11
@jenya7771

$routeProvider.when('/detaileddis/:infoId', {

<td><a data-ng-href="#/detaileddis/{{info.id}}">{{info.id}}</a></td>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question