我是AngularJs Material的初学者,我想打开一个'mdbottomsheet'并在这个工作表中放一个按钮,当点击按钮时,打开另一个'mdbottomsheet',而不关闭第一个'mdbottomsheet'.
有HTML代码:
<div ng-controller="MyController">
<md-button ng-click="openBottomSheet()">
Open a Bottom Sheet!
</md-button>
</div>
Run Code Online (Sandbox Code Playgroud)
有Js:
var app = angular.module('app', ['ngMaterial']);
app.controller('MyController', function($scope, $mdBottomSheet) {
$scope.openBottomSheet = function() {
$mdBottomSheet.show({
controller: 'BottomSheet',
template: '<md-bottom-sheet>Hello!
<md-button ng-click="openSecondBottomSheet()">
Open Second Bottom Sheet!
</md-button></md-bottom-sheet>'
});
};
});
Run Code Online (Sandbox Code Playgroud)
并在'BottomSheet'控制器中:
var app = angular.module('app', ['ngMaterial']);
app.controller('BottomSheet', function($scope, $mdBottomSheet) {
$scope.openSecondBottomSheet = function() {
$mdBottomSheet.show({
controller: 'SecondBottomSheet',
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>'
});
};
});
Run Code Online (Sandbox Code Playgroud)
这是我的代码,它可以工作但是当'SecondBottomSheet'打开时,首先'BottomSheet'关闭!我想在第一个'BottomSheet'上打开'SecondBottomSheet'!
我有一个包含多个图表的页面,并且我为每个图表的导出上下文菜单添加了特定选项.我需要在单击任何项目时调用somefunction().这绝对有效,但不正确!
这是我正在使用的代码:
HelloWorld = function () {
var items = [];
for (var index = 0; index<5; index++) {
items.push({text: "items "+index, onclick: function() {
alert(index);
}});
}
return items;
};
buttons: {
contextButton: {
menuItems: HelloWorld()
}
}
Run Code Online (Sandbox Code Playgroud)
点击任何项目时,点击功能提醒(5)!非常感谢!
我有两个 Web 应用程序(应用程序 A 和应用程序 B),并且想将其中一个(A)用作另一个(B)中的 iframe。我在当前的 Web 应用程序 (B) 中有一个令牌,它在 iframe (A) 中也有效。iframe Web 应用程序 (A) 使用 OIDC js 身份验证和 angularjs,现在如何将令牌从 B 发送到 A 并使用它?
在我的 A 应用程序中,我有这个:
var config = {
authority: '...my auth server ...',
client_id: '...'
...
}
mgr = new OidcTokenManager(config);
if (window.location.hash && window.location.hash.indexOf('id_token') > -1) {
mgr.processTokenCallbackAsync().then(function () {
//checkSessionState();
}, function (error) {
});
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,但是当我使用 A 作为 iframe 时,mgr
没有启动正确的和一些access_token
未定义的属性!
如果在定义类构造函数时返回一个对象会发生什么?我可以使用它来确保安全并避免访问类方法并且......?
例如我有下面的代码:
class X {
y = ''
x = 0
constructor(
p1,
p2,
) {
this.p1 = p1
this.p2 = p2
return {
getp1: this.getp1
}
}
getp1 = () => this.p1
}
let x = new X("fo", "bar")
console.log(x.p1) // will be undefined
console.log(x.getp1() ) // will be "fo"
Run Code Online (Sandbox Code Playgroud)
如您所见,x.p1
无法直接访问,但我可以p1
通过getp1
方法获得。我可以在 javascript 中使用它private
和方法吗?public