Reputation: 386
I am doing an angular dropdown list with bootstrap. I have created a directive where the user selects a menu option from the dropdown and alerts the user.
I have created a plnkr here
http://plnkr.co/edit/tw3O5ihT7YB79BcAGlsh?p=preview
(function() {
'use strict';
angular.module('plunker').directive('exportData', exportData);
function exportData() {
var controller = function() {
var vmd = this;
vmd.exportAction = [{
id: 1,
action: 'Export all -> excel',
visble: true
}, {
id: 2,
action: 'Export selected -> excel',
visble: true
}, {
id: 0,
action: '',
visble: true,
divider: true
}, {
id: 3,
action: 'Export all -> pdf',
visble: true
}, {
id: 4,
action: 'Export selected -> pdf',
visble: true
}];
function activate() {} //activate
activate();
vmd.selectedExport = function(action) {
alert("you selected " + action.action);
};
} //controller
return {
restrict: 'EA',
// scope: {
// datasource: '=',
// },
controller: controller,
controllerAs: 'vmd',
templateUrl: 'exportData.html',
bindToController: true
//link: function ($scope, element, attrs) {
// });
};
};
}());
Any ideas, and thanks.
Upvotes: 0
Views: 39
Reputation: 142
You were missing <script src="exportData.js"></script>
in the plunkr example http://plnkr.co/edit/YH4A5bb1o3ss5ECD0j8g
Upvotes: 1