I have a update panel in my master page which contains placeholder for child pages.
Parent.master
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server" EnableViewState="true" ViewStateMode="Enabled">
<ContentTemplate>
<asp:ContentPlaceHolder ID="CPH" runat="server" >
</asp:ContentPlaceHolder>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlClass" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="drpSubjects" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
In child pages I am using angular but the problem is for first load my scope is correct, but if I am updating something my scope is destroyed. I was invoking a function from angular controller through a DOM element which is outside the scope which is throwing exception.
<input type="checkbox" name="something" value="something" onchange="updateCheckBox(this)">
function updateCheckBox(obj) {
angular.element('[ng-controller=ctrl]').scope().UpdateCheckBox(obj);
}
So to overcome this problem I am using following code in my document.ready event.
var mytempScope = angular.element('[ng-controller=ctrl]').scope();
Hence my updated function for updateCheckBox is
function updateCheckBox() {
if (angular.element('[ng-controller=ctrl]').scope() == undefined)
mytempScope.UpdateCheckBox();
else
angular.element('[ng-controller=ctrl]').scope().UpdateCheckBox();
}
This is working perfectly But I want to know is it correct way to ignore Lazy load problem for angular ?
Is there any other solution for this.