Re-initialize Angular bindings after partial postback

时光毁灭记忆、已成空白 提交于 2019-12-11 10:03:44

问题


I am trying to infiltrate an ASP.NET page with some Angular goodness. The problem is that the page has some partial postbacks (Update Panels) that cause my Angular bindings to revert to curly bracket expressions {{ property }}. I can see that the scope is still there in the javascript console.

How do I re-initialize the angular functionality after an Update Panel response ends? I tried $digest and $apply on the scope, but my {{ property }} no longer has the two-way goodness.

(P.S. I will eventually be able to re-write all the postbacks using angular services, but I have a demo in a few days, so it's a mixed bag at the moment.)


回答1:


change the curly braces delimiters to something else in angularjs.

var myApp = angular.module('myApp', [], function($interpolateProvider) {
    $interpolateProvider.startSymbol('[[');
    $interpolateProvider.endSymbol(']]');
});


来源:https://stackoverflow.com/questions/23371744/re-initialize-angular-bindings-after-partial-postback

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!