我正在用 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)
})
});
}
不幸的是,它没有用。
我花了几个小时试图找到解决方案,但我没有设法解决。对于如何使用 AngularJS 使用 JavaScript 编写的 Windows Phone 应用程序,我将不胜感激。