Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9209433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:50:30+00:00 2026-06-18T00:50:30+00:00

So lets say in my HTML I have something like this: <tabcontent></tabcontent> Then the

  • 0

So lets say in my HTML I have something like this:

<tabcontent></tabcontent>

Then the javascript for this directive is this:

tabsApp.directive('tabcontent', function(){

  var myObj = {
    priority:0,
    template:'<div></div>',
    replace: true,
    controller: 'TabCtrl',
    transclude: false,
    restrict: 'E',
    scope: false,
    compile: function (element, attrs){
      return function (parentScope, instanceEle){
        parentScope.$watch('type', function(val) {
          element.html('<div '+val+'></div>');
        });
      }
      $compile(parentScope);
    },
    link: function postLink(scope, iElement, iAttrs){}
  };
  return myObj;

});

The HTML is parsed properly, and the value for type is found in the controller JS.

so <tabcontent></tabcontent> is replaced with <div recipe></div> for example..

(that part does happen properly)

So I also have a directive for recipe:

tabsApp.directive('recipe', function(){

  var myObj = {
    priority:0,
    template:'<div>TESTING</div>',
    replace: true,
    controller: 'TabCtrl',
    transclude: false,
    restrict: 'E',
    scope: false,
    compile: function (element, attrs){
      return {
        pre: function preLink(scope, iElement, iAttrs, controller){},
        post: function postLink(scope, iElement, iAttrs, controller){}
      }
    },
    link: function postLink(scope, iElement, iAttrs){}
  };
  return myObj;

});

Which is obviously pretty simple, and just for testing. But the recipe directive is not being processed…

Whats going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:50:32+00:00Added an answer on June 18, 2026 at 12:50 am

    You need to change 2 things:

    1. The recipe directive must not be restricted to E (element). If you are generating the directive like <div recipe></div>, you must at least add A (attribute) to the restrict property on the directive configuration:

      app.directive('recipe', function() {
         return {
            restrict: 'E',
            ...
      
    2. You need to compile the HTML content of the tabcontent directive after the ‘watch’:

      app.directive('tabcontent', function($compile){
         return {    
         ...    
         link: function (scope, iElement, iAttrs) {
                  scope.$watch('type', function(val) {
                     iElement.html('<div '+val+'></div>');           
                     $compile(iElement.contents())(scope);         
                   });
               }
         ...        
      

    jsFiddle: http://jsfiddle.net/bmleite/n2BXp/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

let's say I have a html structure like this -> (note: in my code
Let's imagine that I have something like this: <html> ... <div> <iframe src=test.html hash=r4d5f7></iframe>
Let's say I have something like this (this is only an example, actual request
lets say i have this html code : <div> <a> <span id=a> </span> </a>
lets say I have a class like this: public class MyClass { private String
Let's say I have something like this in Knockoutjs <pre data-bind=text: ko.toJSON($data, null, 2)>
Lets say I have three divs in my HTML <div> <h2>This is div 1</h2>
Let's say i have html structure like this: How can I make a check
let's say that i have something like this: <head><script src=script1.js ...></script></head> <body><div id=div1></div></body> which
Lets say there are two pages with two different html elements which have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.