1
0
Fork 0
fgdata/webgui/topics/Aircraft/Select.js

40 lines
1,006 B
JavaScript
Raw Normal View History

2015-01-25 12:02:20 +00:00
define([
'jquery', 'knockout', 'text!./Select.html', 'fgcommand', 'kojqui/button'
], function(jquery, ko, htmlString,fgcommand) {
2015-01-25 12:02:20 +00:00
function ViewModel(params) {
var self = this;
self.catalogs = ko.observableArray([]);
self.install = function(pack) {
console.log("install", pack);
// jquery.get('/pkg/install/'+pack.id);
fgcommand.switchAircraft(pack.id);
}
self.uninstall = function(pack) {
console.log("uninstall", pack);
}
self.select = function(pack) {
console.log("select", pack );
}
jquery.get('/pkg/catalogs', null, function(data) {
if( data.catalogs )
self.catalogs(data.catalogs);
2015-01-25 12:02:20 +00:00
});
2015-01-25 12:02:20 +00:00
}
// ViewModel.prototype.dispose = function() {
// }
2015-01-25 12:02:20 +00:00
// Return component definition
return {
viewModel : ViewModel,
template : htmlString
};
});