Angularjs 如何在单击按钮时访问内联模板作为抓取代码的文本值?
我正在寻找一个类似于抓取此url中指定的代码按钮的功能: 当我单击Grabthecode按钮并实现属性时,我希望在小部件中呈现完整的模板 为了实现这一点,我使用一个指令来更改小部件的宽度和高度,并使用和内联templateURL来实现该指令 Grabthecode按钮不是该指令的一部分。我使用以下代码打开代码的弹出窗口Angularjs 如何在单击按钮时访问内联模板作为抓取代码的文本值?,angularjs,angularjs-directive,angularjs-scope,Angularjs,Angularjs Directive,Angularjs Scope,我正在寻找一个类似于抓取此url中指定的代码按钮的功能: 当我单击Grabthecode按钮并实现属性时,我希望在小部件中呈现完整的模板 为了实现这一点,我使用一个指令来更改小部件的宽度和高度,并使用和内联templateURL来实现该指令 Grabthecode按钮不是该指令的一部分。我使用以下代码打开代码的弹出窗口 .controller('iruDiscountWidgetController', ['$scope', 'ngDialog', function($scope, ngDial
.controller('iruDiscountWidgetController', ['$scope', 'ngDialog',
function($scope, ngDialog) {
$scope.resize = function(evt, ui) {
$scope.w = ui.size.width;
$scope.h = ui.size.height;
$scope.getCode = function() {
ngDialog.open({
template: '<div>Copy your code:<br /><br />' +
'<textarea rows="4" cols ="50" value="yahoo" ></textarea></div>',
plain: true,
scope: $scope,
controller: ['$scope', function($scope) {}]
});
}
}
}]);
.controller('irudeportwidgetcontroller',['$scope','ngDialog',
函数($scope,ngDialog){
$scope.resize=函数(evt,ui){
$scope.w=ui.size.width;
$scope.h=ui.size.height;
$scope.getCode=函数(){
ngDialog.open({
模板:“复制您的代码:
”+
'',
朴素:没错,
范围:$scope,
控制器:['$scope',函数($scope){}]
});
}
}
}]);
我如何访问GrabtheCode按钮的相同模板内容,该模板内容是我在指令中用作在按钮单击时显示的模板URL的内容?有什么建议吗