0

I have a simple directive, <my-directive></my-directive>

client/scripts/directives/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>

Why will the text not show when I use the directive in another page?

1
  • Your question isn't really clear. For starters, you have the templateUrl for your directive set to '/client/templates/partials/liftOwnerConfirmedRiders.html', but you are showing the contents of 'client/templates/partials/myDirective.html', which I assume is a missed change when trying to make the example. Beyond that, you aren't showing where these are being used, what ng-app context the directive is under on the other page, and where the script for this directive is loaded in your HTML. Commented Jan 10, 2016 at 22:47

2 Answers 2

1

I had troubles with displaying meteor-angular directives, but they were gone when I've added ['angular-meteor'] to my module definition:

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

Also, my templateUrl differs from yours. It starts without slash :

templateUrl: 'client/templates/tabset.html'
Sign up to request clarification or add additional context in comments.

Comments

0

This most commonly happens to me when I fail to reference the directive JS (and any dependencies) in the page. If you don't load the directive in the page where it's used then it will just be ignored by the browser and won't even throw an error in the console (unless it's missing a dependency too).

As Claies writes, we need more context if you want more than generic responses like this.

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.