2

我正在使用带有 angualrjs 的 nodewebkit 并且我的 routeProvider 有一些问题,这个简单的示例在浏览器中运行良好,但是当我使用 nodewebkit 并单击带有指向路由器的链接的某个链接时,这没有任何作用

 var musicPlayer = angular.module("musicPlayer", ["ngRoute"]);


    musicPlayer.config(function($routeProvider, $locationProvider){
        $routeProvider.
            when("/",{
                templateUrl: "/app/views/albums.html",
                controller: "indexCtrl"
            }).
            when("/album/:id", {
                templateUrl: "/app/views/album.html",
                controller: "albumCtrl"
            }).
            otherwise({
                redirectTo: "/parking"
            });


    });


    musicPlayer.controller("indexCtrl", function($scope){
        var albums = [
            {
                id: 1,
                band: "megadeth",
                name: "Rust in peace"
            },
            {
                id: 2,
                band: "megadeth",
                name: "Peace sells"
            }
        ];

        $scope.albums = albums;
    });

    musicPlayer.controller("albumCtrl", function($scope){
        console.log("album")
    });

在nodewebkit devtools中,来自角度的ng-repeat创建这个url不安全:app://host/app/views/index.html#/album/1任何想法?

AngularJS v1.2.0

好吧,我修复了在配置中添加这个

 // Add app: protocol for node-webkit
    .config(['$compileProvider', function($compileProvider) {   
        $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|app):/);
    }]);
4

0 回答 0