0

私はブートストラップ、angularjsを使ってWebアプリケーションを開発しました。私はページ間をルーティングするためにrouteproviderを使用しました。 Visual Studioを使用してデバッグしたときにアプリが正常に動作していました。アプリケーションは正常に動作しており、ページ間を移動することができます。しかし、ローカルマシンからindex.htmlをロードすると、file:///C:/Users/index.htmlスクリプトファイルはロードされず、何も動作しません。私はcordovaを使ってこのwebappをモバイルアプリにデプロイする必要があります。 ありがとうございます。 browsersの限界だローカルマシンからロードされたときにRouteProviderが動作しない

script.js

app.config(['$routeProvider', '$httpProvider','$compileProvider','$locationProvider', function ($routeProvider, $httpProvider, $compileProvider,$locationProvider) { 
$routeProvider. 
when('/web', {           /* Route provider with masterpage and templates*/ 
    templateUrl: 'templates/web.html', 
    controller: 'webctrl' 
}). 
    when('/login', { 
     templateUrl: 'templates/login.html', 
     controller: 'webctrl' 
    }). 
    when('/register', { 
     templateUrl: 'templates/register.html', 
     controller: 'webctrl' 
    }). 
when('/account', { 
    templateUrl: 'templates/account.html', 
    controller: 'accountctrl' 
}). 
when('/share', { 
    templateUrl: 'templates/share.html', 
    controller: 'sharectrl' 
otherwise({ 
    redirectTo: '/web' 
}); 
$locationProvider.html5Mode(true); 

$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/); 
}]); 

答えて

0

使用のWebサーバー:これは、HTMLページ、開いたフォームファイルシステムは、セキュリティ

ソリューションとしてそれを取る...信頼できるソースとして扱われていない、意図されます。

すべての種類。そして、常にあなたのページをそのようなWebサーバーリクエストとして提供してください。

+0

コードバスに展開する際にこの制限を取り除く方法 – Alan

関連する問題