0

奇妙な問題があります。ブラウザーでhttp://mysite.com:1540/#/5を手動で参照すると、Angular ルートが呼び出され、すべて正常に動作します。ただし、URL の下のリンクのいずれかをクリックすると、ブラウザーで変更されますが、ルートはトリガーされません。新しいIDがURLに配置されたときに呼び出される関数に関するアラートがあるため、これを確認しました。これについて何か助けていただければ幸いです。

前もって感謝します。

> //this is the route   $routeProvider.when("/:id", {
>       controller: "topicsControllerByPage",
>       templateUrl: "/templates/topicsView.html"   });
> 
> 
> var topicsControllerByPage = ["$scope", "$http",
> "dataService","$routeParams",   function ($scope, $http, dataService,
> $routeParams) {
>       $scope.data = dataService;
>       $scope.isBusy = false;
> 
> 
>       if (dataService.isReady() == false) {
>           $scope.isBusy = true;
> 
>           dataService.getTopicsByPage($routeParams.id)
>             .then(function () {
>                 // success
> 
>             },
>             function () {
>                 // error
>                 alert("could not load topics");
>             })
>             .then(function () {
>                 $scope.isBusy = false;
>             });
>       }   }]; var newTopicController = ["$scope", "$http", "$window", "dataService",   function ($scope, $http, $window, dataService) {
>     $scope.newTopic = {};
> 
>     $scope.save = function () {
>         //alert($scope.newTopic.title);
>         //alert($scope.newTopic.filepath);
>       dataService.addTopic($scope.newTopic)
>         .then(function () {
>           // success
>           $window.location = "#/";
>         },
>         function () {
>           // error
>           alert("could not save the new topic");
>         });
> 
>     };   }];




 <div class="pagination pagination-centered">
                <ul>
                    <li class=" disabled"><a href="#">« </a></li>
                    <li class="active"><a href="#">1</a></li>
                    <li></li>

                    <li><a href="#/2">2</a></li>
                    <li></li>
                    <li><a href="#/3">3</a></li>
                    <li></li>
                    <li><a href="#/4">4</a></li>
                    <li></li>
                    <li><a href="#/5">5</a></li>
                    <li></li>                    
                    <li><a href="#/2"> »</a></li>
                </ul>
            </div>
4

1 に答える 1