使用AngularJS的JavaScript中的Windows Phone应用程序

use*_*787 3 javascript winjs angularjs windows-phone-8.1

我正在用JavaScript开发Windows Phone应用程序.我正在使用AngularJS图书馆.问题是由于安全原因我无法添加动态内容.

我得到的错误: HTML1701: Unable to add dynamic content '<div id="view_login" class="view"> <div id="view_login_container"> <img class="logo" src="http://oi60.tinypic.com/okwifa.jpg"> <input type="text" placeholder="Username" ng-model="loginUsername"> <input type="password" placeholder="******" ng-model="loginPassword"> <button ng-click="doLogin()">Login</button> <button ng-click="changeView('/signup')" class="link">... or sign up now</button> </div> </div>'. A script attempted to inject dynamic content, or elements previously modified dynamically, that might be unsafe. For example, using the innerHTML property to add script or malformed HTML will generate this exception. Use the toStaticHTML method to filter dynamic content, or explicitly create elements and attributes with a method such as createElement. For more information, see http://go.microsoft.com/fwlink/?LinkID=247104.

我在AngularJS库中更改了一行来修复问题:

append:function(a,c){
   **MSApp.execUnsafeLocalFunction(function () {**
      r(new N(c),function(c){
         1!==a.nodeType&&11!==a.nodeType||a.appendChild(c)
      })
   });
} 
Run Code Online (Sandbox Code Playgroud)

不幸的是它没有用.

我花了几个小时试图找到解决方案,但我没有管理它.我将不胜感激任何建议如何使用AngularJS编写用JavaScript编写的Windows Phone应用程序.

小智 5

Microsoft Open Technologies最近发布了一个垫片,它可以防止使用AngularJS的Windows Store应用程序以及许多其他流行的JavaScript库出现这个问题.

只需从GitHub 下载JavaScript Dynamic Content垫片,然后在运行任何其他脚本之前将文件引用到应用程序的开头.您不应再看到动态内容错误.

如果这解决了您的问题,请告诉我!