AngularJS和Windows 8路线错误 [英] AngularJS and Windows 8 route error
问题描述
我试图创建一个HTML5 / JS / CSS3与应用目前我卡上的参数发送到其他视图与Visual Studio 2012在Windows 8.1 angularJS。
I'm trying to create a HTML5/JS/CSS3 App with angularJS on Windows 8.1 with visual studio 2012. I'm currently stuck on sending over parameters to other views.
googleing当我看到使用&LT几个例子; A HREF =#/页/ {{:PAGEID}}>链接< / A>
当我做这个中的链接在我的Windows 8应用程序,然后点击我收到以下错误。
When googleing I see several examples using <a href="#/page/{{:pageId}}">link</a>
When I do this in my Windows 8 application and clicking on the link I am getting the following error.
没有应用程序安装到打开这类链接(不安全)
No Apps are installed to open this type of link (unsafe)
当我把 {{:PAGEID}}
code中的一个标签之间就说明其ID
When I put the {{:pageId}}
code between the A tags it shows its ID.
app.js
var myApp = angular.module('myApp', ['ngRoute', 'ngResource']);
myApp.config(['$routeProvider', function($routeProvider) {
$routeProvider.when("/", { templateUrl: "views/home.html" })
.when("/page/:pageId", { templateUrl: "views/page.html" })
.otherwise({ redirectTo: "/" });
}]);
什么是解决这一问题的解决方案?
What is a solution to solve this problem?
- 更新 -
我已经做了一些更多的调试。
在浏览器中它是所有工作的罚款。
在Visual Studio中,我发现以下内容:
I have done some more debugging. In the browser it's all working fine. In visual studio I have found the following:
<a class="ng-binding" href="unsafe:ms-appx://3595d292-0235-47cd-8db7-cb3019f29114/www/index.html#/page/1" data-ng-href="#/page/1">Select</a>
看起来像VS是增加了一些code。在源我没有包括在href项目
Looks like VS is adding some code. In the source I haven't include the href item
我已经改变了链接,一切似乎不错,也是正确的变量只加载VS不断增加不安全:'在链路的藻体
I have changed the link and all seems fine, also the correct variable is loaded only VS keeps adding 'unsafe:' at the frond of the link.
推荐答案
问题解决了!
好像正由女士补充导致问题的MS-APPX。这是由addeing该跟随code解决。
seems like the ms-appx that is being added by ms causes the problem. This is being resolved by addeing this following code.
AngularJS 1.2
AngularJS 1.2
app.config(['$compileProvider', function($compileProvider) {
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|file|ms-appx):/);
}]);
有关1.1.x和1.0.x中,使用urlSanitizationWhitelist。
For 1.1.x and 1.0.x, use urlSanitizationWhitelist.
如果您使用PhoneGap的,记得补充文件除了HTTPS?否则,链接将无法正常工作。
If you use PhoneGap, remember to add file besides https?, otherwise, links will not work.
这篇关于AngularJS和Windows 8路线错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!