javascript - Meteor AngularJS 应用程序未加载指令

标签 javascript angularjs

我有一个简单的指令,<my-directive></my-directive>

客户端/脚本/指令/myDirective.directive.js:

angular
  .module('myApp')
  .directive('myDirective', myDirective);

function myDirective() {
  return {
    restrict: 'AE',
    scope: {
      data: '='
    },
    templateUrl: "'/client/templates/partials/liftOwnerConfirmedRiders.html'",
  };
}

client/templates/partials/myDirective.html:

<p>Hi. How are you?</p>

为什么当我在另一个页面中使用该指令时,文本不会显示?

最佳答案

我在显示 Meteor-Angular 指令时遇到了麻烦,但是当我将 ['Angular-Meteor'] 添加到我的模块定义中时,它们就消失了:

angular.module('myApp', ['angular-meteor'])

此外,我的 templateUrl 与你的不同。它开始时没有斜杠:

templateUrl: 'client/templates/tabset.html'

关于javascript - Meteor AngularJS 应用程序未加载指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34711228/

相关文章:

JavaScript 将值拆分为数组

javascript - AngularJS 选择框 - ngClick 未触发

regex - ng-pattern 在正则表达式应该禁止它时允许空间

angularjs - 将PhantomJS与Karma一起使用(Win7 x64)

angularjs - ui-route 解析不起作用

JavaScript - 两个时间字符串之间的区别

javascript - 当needle是变量时替换global

javascript - 使用 Angular JS 将简单函数转换为工厂或服务时遇到问题

java - 具有 MEAN 堆栈和 Java 的 Webapp

javascript - CSS 导航链接样式 : remove styling of other element & remove double border when hovered on selected