0

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.

0

1 Answer 1

1

You were missing <script src="exportData.js"></script> in the plunkr example http://plnkr.co/edit/YH4A5bb1o3ss5ECD0j8g

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.