【问题标题】:Angular directive not displaying角度指令不显示
【发布时间】:2016-08-04 20:17:15
【问题描述】:

我正在使用引导程序制作一个角度下拉列表。我创建了一个指令,用户从下拉列表中选择一个菜单选项并提醒用户。

我在这里创建了一个 plnkr

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) {
        //    });
    };
  };
}());

任何想法,谢谢。

【问题讨论】:

    标签: javascript angularjs


    【解决方案1】:

    您在 plunkr 示例中缺少 <script src="exportData.js"></script> http://plnkr.co/edit/YH4A5bb1o3ss5ECD0j8g

    【讨论】:

      猜你喜欢
      • 2018-06-01
      • 2019-02-13
      • 1970-01-01
      • 2019-06-12
      • 1970-01-01
      • 1970-01-01
      • 2016-05-05
      • 1970-01-01
      • 2019-11-21
      相关资源
      最近更新 更多