2016-09-23 13 views
0

私はangularjsで新しいです。私はアンカータグを使っていくつかのデータを持つインデックスページを持っています。ユーザーが特定のアンカータグページをクリックすると、リストページとデータ表示にリダイレクトされますが、ngRouteは動作しません。文字列値。どこで間違った
これは私のインデックスページangularjs ngroute not working

<div class="all_cat" ng-repeat="state in statelist"> 
    <h2>{{state.Statename}}</h2> 
    <div class="cat-col-4" ng-repeat="citylist in state.city"> 
     <ul> 
      <li><i class="fa fa-caret-right"></i><a href="/Job/JobList/{{citylist.ID}}">{{citylist.cityname}} </a>({{citylist.jobcount}})</li> 
     </ul> 
    </div> 
    <div class="clear"></div> 
</div> 

であり、これは

var app = angular.module('angularTable', ['ngSanitize', 'ui.select', 'angularTrix', 'ngRoute']); 
app.config(function($routeProvider) { 
    debugger; 
    $routeProvider 
     .when('/JobList:ID', { 
      templateUrl: 'job/JobList.cshtml', 
      controller: 'joblist' 
     }) 

}); 


app.controller('joblist', function($scope, $routeParams) { 
    debugger; 
    $scope.message = 'Clicked person name from home page should be display here'; 
    $scope.person = $routeParams.ID; 
}); 

私が間違って行うスタンドの下にはないです

+1

あなたは '/ JOBLIST /たい場合があります:代わりに'/JOBLISTのID':ID' – taguenizy

+0

同じ問題$ routeParams.IDは –

+0

に定義されていない、あなたは '$ルートを試してみました。 current.params'またはそれに類するもの? – taguenizy

答えて

0

尻のbrajaのLALがMahantyは、あなたが望むかもしれない言う私のjsであります/ JobList /:/ JobList:IDの代わりにIDを指定します。 だからあなたのように状態を設定する必要があります。

$routeProvider 
.when('/JobList/:ID', { 
     templateUrl: 'job/JobList.cshtml', 
     controller: 'joblist' 
    }) 
}); 
関連する問題