[英]How to change popup title scope variable dynamically when button click in AngularJS
I have two popup's having in a single html page, i need to change the popup title based on popup click.我在一个 html 页面中有两个弹出窗口,我需要根据弹出窗口点击更改弹出窗口标题。 I'm using title for $scope variable.
我正在使用 $scope 变量的标题。 I tried the below code but it is not changing the title, please help me on this.
我尝试了下面的代码,但它没有改变标题,请帮助我。
Html: Html:
<div id="Popup" title="{{title}}">
<div data-ng-include src="'Partials/Popup.html'" data-ng-show="newPopup"></div>
</div>
JS: JS:
$scope.PopupOne = function() {
$scope.title = 'Popup One'; // I tried this
$scope.ShowPopup('Popup');
Factory.HttpRequest('ABC1.ashx', dataJson)
.success(function(dt) {
//parameters
}
};
}
$scope.PopupTwo = function() {
$scope.title = 'Popup Two'; //I tried
$scope.ShowPopup('Popup');
Factory.HttpRequest('ABC2.ashx', dataJson)
.success(function(dt) {
//parameters
}
};
}
When i click popup button on the popup title is not showing but i can able to see at inspect elements Please see the image当我单击弹出窗口上的弹出按钮时,弹出标题未显示,但我可以在检查元素处看到 请看图片
var myDynamicValue = $scope[title];
$scope.PopupTwo = function () {
$scope.title = myDynamicValue; //I tried
$scope.ShowPopup('Popup');
Factory.HttpRequest('ABC2.ashx', dataJson)
.success(function (dt) {
//parameters
}
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.