mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 21:27:52 +00:00
[Selection] Use AngularView for context menus
This commit is contained in:
parent
15ef89f455
commit
3b4239fbd9
@ -1,6 +1,7 @@
|
||||
define(['angular'], function (angular) {
|
||||
function AngularView(template) {
|
||||
function AngularView(template, scopeFn) {
|
||||
this.template = template;
|
||||
this.scopeFn = scopeFn;
|
||||
}
|
||||
|
||||
AngularView.prototype.show = function (container) {
|
||||
@ -12,6 +13,9 @@ define(['angular'], function (angular) {
|
||||
var $compile = $injector.get('$compile');
|
||||
var $rootScope = $injector.get('$rootScope');
|
||||
var $scope = $rootScope.$new();
|
||||
|
||||
this.scopeFn($scope);
|
||||
|
||||
var elements = $compile(this.template)($scope);
|
||||
|
||||
angular.element(container).append(elements);
|
||||
|
@ -1,16 +1,16 @@
|
||||
define(['zepto'], function ($) {
|
||||
define([
|
||||
'zepto',
|
||||
'text!./context-menu.html',
|
||||
'../../adapter/ui/AngularView'
|
||||
], function ($, template, AngularView) {
|
||||
|
||||
function ContextMenuView(actions) {
|
||||
this.actions = actions;
|
||||
AngularView.call(this, template, function ($scope) {
|
||||
$scope.actions = actions;
|
||||
});
|
||||
}
|
||||
|
||||
ContextMenuView.prototype.show = function (element) {
|
||||
var $els = $('<span>Hello context menu!</span>');
|
||||
$(element).append($els);
|
||||
};
|
||||
|
||||
ContextMenuView.prototype.destroy = function () {
|
||||
|
||||
};
|
||||
ContextMenuView.prototype = Object.create(AngularView.prototype);
|
||||
|
||||
return ContextMenuView;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user