- parse the html template and collect all directives.
- bind directives with scope and produce the final html
- First, establish the parent-child relationship in the DOM. At this stage, we are talking about the template DOM, not the final html. The directives in parent are always handled first.
- Directives with higher priority in the same node are handled before those with lower priority.
Compilation
Step 1 :So give this example in plunker, the normal order will be like this A1(priority 99)->A3 and form(priority 0),->A2(priority -1)->B1 (child). Once the order is established, the compilation is finished.Link
Step 2 :controller for each directive is called following the established order. Each controller has its turn to augment the scope. The scope is fully established after this step.Step 3: The link function for each directive is called in reverse order. So here the order is B1->A2->A3 and form->A1.
The example in the plunker logs all controller call and link function call to console. You can turn on the console to view the compilation and link sequencer.
Let us see how we can use this knowledge to tackle one tough problem I face in one of my project. In one of my project, I need to generate dynamic form whose name is determined by scope property. But the ngForm property only accepts literal text instead of an expression for the form name. How can we tweak the compilation/link process to make the form to accept an expression? This question is also asked in stackflow.
Alter the link flow with terminal property
I replaced A2 with another directive A4 following the suggestion in the stackflow section. A41 is terminal. In the link function, it changes/add form name by evaluating an expression.testApp.directive("testA41", function($compile){
return {
terminal:true,
priority:101,
restrict: 'A',
controller: function($scope, $element, $attrs){
if ($element.controller("form")==null){
console.log("controller: A41-101:NO form ");
} else {
console.log("controller: A41-101: YES form");
}
},
link: function(scope, element, attrs){
if (element.controller("form")==null){
console.log("\t link:A41-101: No form");
} else {
console.log("\t: link A41-101: YES form");
}
element.removeAttr("data-test-a41"); //avoid infinite loop
element.removeAttr("test-a41");
attrs.$set("name","test"); //set name
$compile(element)(scope); //recompile
}
};
});
In step 2, the controller is called by the order A41(priority 101)->A1->A3 and form(priority 0)->B1 (child). Since A41 is terminal, A1->A3 and form(priority 0)->B1 (child) is never called. The normal flow is interrupted.
In step 3, only A41 is called, all others are skipped. Inside A4's link function, A4 removes itself from element and use $compile to start a compilation process. Basically A4 asks angularjs re-perform step 1, step2 and step 3. But this time, form name is set.
communicate with each other through controller
angularjs suggests directives comunicate with each other through link function. But in our case, we could communicate each other with controller. we just need a controller that alters element's name before ngForm directive is called. So for this we have new directive A5.testApp.directive("testA5", function($compile){
return {
priority:101,
restrict: 'A',
controller: function($scope, $element, $attrs){
if ($element.controller("form")===null){
console.log("controller: A5-101:NO form ");
} else {
console.log("controller: A4-101: YES form");
}
$element.removeAttr("data-test-a5"); //do not remove if we have link function
$element.removeAttr("test-a5");
$attrs.$set("name","test");
},
link: function(scope, element, attrs){
if (element.controller("form")===null){
console.log("\t link:A5-101: No form");
} else {
console.log("\t: link A5-101: YES form");
}
}
};
});
This new directive move the name change to controller. It has a higher priority than form. So when it comes to form directive, the name is ready. This solution is better than previous one since we do not change any compilation flow
Excellent I love the posts here, very helpful for developers in the their application development....
ReplyDeleteAngularjs online Training
nice posts..
ReplyDelete]
Big data training .All the basic and get the full knowledge of hadoop.
Big data training
Big data and data warehousing related information is always updated to me at hadoop online training in hyderabad. Nice insight on the topic refer the details at
ReplyDeletehadoop online training
I will definitely be re-using this tool and spreading the word about it, thanks!!
ReplyDeleteInformatica Training in Chennai
Informatica Training Chennai
Android Course in Chennai
I have read your blog its very attractive and impressive. I like it your blog.
ReplyDeleteAngularjs Online Training Angularjs Training Angularjs Training Angularjs Training in Chennai Angularjs Training in Chennai
ReplyDeleteI like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting!!
Best Devops Training Institute
Thanks for updating this quality stuff. Treasurebox always provide you quality stuff for your home and garden.
ReplyDeleteWe will also provide you outdoor furniture with home delievery.
The article is very interesting and very understood to be read, may be useful for the people. I wanted to thank you for this great read!! I definitely enjoyed every little bit of it. I have to bookmarked to check out new stuff on your post. Thanks for sharing the information keep updating, looking forward for more posts..
ReplyDeleteKindly visit us @
Madurai Travels | Travels in Madurai
Best Travels in Madurai
Cabs in Madurai | Madurai Cabs
Tours and Travels in Madurai
Excellent Blog. I really want to admire the quality of this post. I like the way of your presentation of ideas, views and valuable content. No doubt you are doing great work. I’ll be waiting for your next post. Thanks .Keep it up!
ReplyDeleteKindly visit us @
Luxury Packaging Box
Wallet Box
Perfume Box Manufacturer
Candle Packaging Boxes
Luxury Leather Box
Luxury Clothes Box
Luxury Cosmetics Box
Shoe Box Manufacturer
Luxury Watch Box
Nice blog, it's so knowledgeable, informative, and good looking site. I appreciate your hard work. Good job. Thank you for this wonderful sharing with us. Keep Sharing.
ReplyDeleteKindly visit us @
100% Job Placement
Best Colleges for Computer Engineering
Biomedical Engineering Colleges in Coimbatore
Best Biotechnology Colleges in Tamilnadu
Biotechnology Colleges in Coimbatore
Biotechnology Courses in Coimbatore
Best MCA Colleges in Tamilnadu
Best MBA Colleges in Coimbatore
Engineering Courses in Tamilnadu
Engg Colleges in Coimbatore
ReplyDeleteA very inspiring blog your article is so convincing that I never stop myself to say something about it.
Great Article
ReplyDeleteFinal Year Project Domains for CSE
Final Year Project Centers in Chennai
JavaScript Training in Chennai
JavaScript Training in Chennai
Wonderful post, This article have helped greatly continue writing ..
ReplyDeleteI´ve been thinking of starting a blog on this subject myself .....
ReplyDeleteThanks for sharing information. I really appreciate it.
ReplyDeleteA very interesting blog....
ReplyDeleteThanks for sharing...
ReplyDeleteVery good Keep it up.
This is so great. Thanks for sharing....
ReplyDeleteWonderful post, This article have helped greatly continue writing ..
ReplyDeleteI´ve been thinking of starting a blog on this subject myself .....
ReplyDeleteThanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
ReplyDeletebest workday studio online training
Nice blog, it’s so knowledgeable, informative, and good looking site. I appreciate your hard work. Good job. Thank you for this wonderful sharing with us. Keep Sharing.
ReplyDeleteA very inspiring blog your article is so convincing that I never stop myself to say something about it.
ReplyDeleteWe as a team of real-time industrial experience with a lot of knowledge in developing applications in python programming (7+ years) will ensure that we will deliver our best in python training in vijayawada. , and we believe that no one matches us in this context.
ReplyDeleteA very interesting blog....
ReplyDeleteIt’s so knowledgeable Nice blog...
ReplyDeleteThanks for sharing...
ReplyDeleteVery good Keep it up.
Find my blog post here
ReplyDeleteweb designer
salesforce developer
laravel developer
web developer
Hello Admin!
ReplyDeleteThanks for the post. It was very interesting and meaningful. I really appreciate it! Keep updating stuffs like this. If you are looking for the Advertising Agency in Chennai | Printing in Chennai , Visit Inoventic Creative Agency Today..
Nice blog, it’s so knowledgeable, informative, and good looking site. I appreciate your hard work. Good job. Thank you for this wonderful sharing with us. Keep Sharing.
ReplyDeleteKeep sharing the post like this...
ReplyDeleteThanks for sharing such a great blog
ReplyDeleteVermicompost Manufacturers | Best Vermicompost in chennai
Thanks for posting such a great blog
ReplyDeleteVermicompost Manufacturers | Vermicompost in chennai
This is a wonderful article, Given so much info in it, Thanks for sharing. CodeGnan offers courses in new technologies and makes sure students understand the flow of work from each and every perspective in a Real-Time environmen python training in vijayawada. , data scince training in vijayawada . , java training in vijayawada. ,
ReplyDeleteNice blog, it’s so knowledgeable, informative, and good looking site. I appreciate your hard work. Good job. Thank you for this wonderful sharing with us. Keep Sharing.
ReplyDeleteTours and Travels in Madurai | Best tour operators in Madurai
Best travel agency in Madurai | Best Travels in Madurai
Nice to see this BLOG..keep updating More infromation Digital Lync offers one of the best Full Stack training in Hyderabad with a comprehensive course curriculum with Continuous Integration, Delivery, and Testing. Elevate your practical knowledge with quizzes, assignments, Competitions, and Hackathons to give a boost to your confidence with our hands-on Full Stack Training.
ReplyDeleteweb development courses
full stack developer course
full stack developer course in hyderabad
web development courses in gachibowli
front end developer course
full stack developer course with placement
Hi, Very nice article. I hope you will publish again such type of post. Thank you!
ReplyDeleteCorporate gifts ideas | Corporate gifts
Corporate gifts singapore | Corporate gifts in singapore
Promotional gifts singapore | Corporate gifts wholesale Singapore
ReplyDeleteThanks for sharing such a great blog
Vermicompost manufacturers in Tamilnadu | Vermicompost in Tamilnadu
Vermicompost Manufacturers | Vermicompost Suppliers
Vermicompost in Coimbatore | Vermicompost manufacturers in Chennai
Vermicompost in chennai | Best Vermicompost in chennai
.
Lovely blog...! It is one of the best posts for this topic and I really appreciate your great efforts. Keep continuing...
ReplyDeletePlacement Training in Chennai
Best placement Training institutes in Chennai
Power BI Training in Chennai
Graphic Design Courses in Chennai
Pega Training in Chennai
Oracle DBA Training in Chennai
Oracle Training in Chennai
Soft Skills Training in Chennai
JMeter Training in Chennai
Tableau Training in Chennai
Appium Training in Chennai
Placement Training in Anna Nagar
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
ReplyDeleteservicenow online training
best servicenow online training
top servicenow online training
It's very useful article with inforamtive and insightful content and i had good experience with this information. We, at the CRS info solutions ,help candidates in acquiring certificates, master interview questions, and prepare brilliant resumes.Go through some helpful and rich content Salesforce Admin syllabus from learn in real time team. This Salesforce Development syllabus is 100% practical and highly worth reading. Recently i have gone through Salesforce Development syllabus and Salesforce Admin syllabus which includes Salesforce training in USA so practically designed
ReplyDeleteI just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!
ReplyDeleteAWS training in chennai | AWS training in anna nagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery
Great info! I recently came across your blog and have been reading along. I thought This is an awesome post.Thanks for this blog,
ReplyDeleteSelenium Training in chennai | Selenium Training in anna nagar | Selenium Training in omr | Selenium Training in porur | Selenium Training in tambaram | Selenium Training in velachery
Want to know about Cat Day, which is a special; day dedicated to your pet cat. Just check out my blog.nice page to read.
ReplyDeleteC and C++ Training Institute in chennai | C and C++ Training Institute in anna nagar | C and C++ Training Institute in omr | C and C++ Training Institute in porur | C and C++ Training Institute in tambaram | C and C++ Training Institute in velachery
ReplyDeleteHi, Very nice article. I hope you will publish again such type of post. Thank you!
Corporate gifts ideas | Corporate gifts
Corporate gifts singapore | Corporate gifts in singapore
Promotional gifts singapore | Corporate gifts wholesale Singapore
leather corporate gifts singapore | t shirts supplier singapore
thumb drive supplier singapore | business card holder singapore
corporate gifts supplier | customized corporate gifts singapore
corporate gifts supplier singapore
Hi, Very nice article. I hope you will publish again such type of post. Thank you!
ReplyDeleteCorporate gifts ideas | Corporate gifts
Corporate gifts singapore | Corporate gifts in singapore
Promotional gifts singapore | Corporate gifts wholesale Singapore
Business card holder singapore | T shirts supplier singapore
Thumb drive supplier singapore | Leather corporate gifts singapore
nce thanks for sharing......................!
ReplyDeletepega training
pega training
pega training
pega training
pega training
pega training
pega training
Salesforce Admin training
Salesforce Admin training
Salesforce Admin training
sql admin training
angular js training
mulesoft training
puppet training
Thanks for sharing such a great blog
ReplyDeleteVermicompost manufacturers in Tamilnadu | Vermicompost in Tamilnadu
Vermicompost Manufacturers | Vermicompost Suppliers
Vermicompost in Coimbatore | Vermicompost manufacturers in Chennai
Vermicompost in chennai | Best Vermicompost in chennai
Your site is amazing and your blogs are informative and knowledgeable to my websites.This is one of the best tips in my life. I have in quite some time.Nicely written and great info.Thanks to share the more information's.
ReplyDeleteSalesforce Training in Chennai | Certification | Online Course | Salesforce Training in Bangalore | Certification | Online Course | Salesforce Training in Hyderabad | Certification | Online Course | Salesforce Training in Pune | Certification | Online Course | Salesforce Online Training | Salesforce Training
he article is very interesting and very understood to be read.AWS training in Chennai
ReplyDeleteAWS Online Training in Chennai
AWS training in Bangalore
AWS training in Hyderabad
AWS training in Coimbatore
AWS training
Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing this quality information with us. I really enjoyed reading.
ReplyDeleteangular js training in chennai
angular js online training in chennai
angular js training in bangalore
angular js training in hyderabad
angular js training in coimbatore
angular js training
angular js online training
Thanks for sharing an informative blog keep rocking bring more details.I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!
ReplyDeleteArtificial Intelligence Training in Chennai | Certification | ai training in chennai | Artificial Intelligence Course in Bangalore | Certification | ai training in bangalore | Artificial Intelligence Training in Hyderabad | Certification | ai training in hyderabad | Artificial Intelligence Online Training Course | Certification | ai Online Training | Blue Prism Training in Chennai | Certification | Blue Prism Online Training Course
Hi, Very nice article. I hope you will publish again such type of post. Thank you!
ReplyDeleteCorporate gifts ideas | Corporate gifts
Corporate gifts singapore | Corporate gifts in singapore
Promotional gifts singapore | corporate gifts supplier
Forex Signals, MT4 and MT5 Indicators, Strategies, Expert Advisors, Forex News, Technical Analysis and Trade Updates in the FOREX IN WORLD
ReplyDeleteForex Signals Forex Strategies Forex Indicators Forex News Forex World
ReplyDeletetrung tâm tư vấn du học canada vnsava
công ty tư vấn du học canada vnsava
trung tâm tư vấn du học canada vnsava uy tín
công ty tư vấn du học canada vnsava uy tín
trung tâm tư vấn du học canada vnsava tại tphcm
công ty tư vấn du học canada vnsava tại tphcm
điều kiện du học canada vnsava
chi phí du học canada vnsava
#vnsava
@vnsava
ReplyDeleteI am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.I want to share about Mulesoft training in hyderabad .
What as up, I read your blogs like every week. Your writing style is awesome, keep up the good work!
ReplyDeleteOracle Enterprise Manager training
Oracle Exadata online training
Oracle Exadata training
Oracle fusion order management online training
Oracle fusion order management training
Oracle golden gate online training
Oracle golden gate training
Oracle identity manager online training
Oracle identity manager training
Oracle performance tuning online training
Oracle performance tuning training
Oracle rac online training
Oracle rac training
Cognex offers AWS Training in Chennai. Cognex is the best training center in chennai to teach Amazon web server.
ReplyDeleteShield Security Solutions Provides Ontario Security Training, Security Guard License or Security License in Ontario. Get Started Today
ReplyDeleteThanks for sharing information, excellent article, keep continue this....
ReplyDeleteCRT online training
You can do very creative work in a particular field. Exceptional concept That was incredible share. Willy Wonka Jacket
ReplyDeleteIf you follow standard installation procedures, you should not have any problems. unindent does not match any outer indentation level
ReplyDeleteGood Post! , it was so good to read and useful to improve my knowledge as an updated one, keep blogging.After seeing your article I want to say that also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.
ReplyDeletehttps://www.3ritechnologies.com/course/mean-stack-training-in-pune/
Nice post. Thank you to provide us this useful information.
ReplyDeleteBane Coat
Shield Security Solutions Offers Security Guard License Training across the province of Ontario. Get Started Today!
ReplyDeleteSecurity Guard License | Security License | Ontario Security license | Security License Ontario | Ontario Security Guard License | Security Guard License Ontario
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
ReplyDeletemulesoft online training
best mulesoft online training
top mulesoft online training
Hi, Very nice article. I hope you will publish again such type of post. Thank you!
ReplyDeleteCorporate gifts ideas | Corporate gifts
Corporate gifts singapore | Corporate gifts in singapore
Promotional gifts singapore | corporate gifts supplier
ReplyDeleteI am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.I want to share about Mulesoft training .
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
ReplyDeleteworkday hcm online training
best workday hcm online training
top workday hcm online training
Thanks for sharing this information. I really appreciate it.
ReplyDeleteIphone service center in tnagar | Iphone service center in chennai
Lenovo mobile service center in Tnagar | Lenovo Mobile service center in chennai
Moto service center in t nagar | Motorola service center in t nagar
Moto Service Center in Chennai | Motorola Service Center in chennai
I just loved your article on the beginners guide to starting a blog.If somebody take this blog article seriously
ReplyDeletein their life, he/she can earn his living by doing blogging.Thank you for this article.
tibco sportfire online training
I just loved your article on the beginners guide to starting a blog.If somebody take this blog article seriously
ReplyDeletein their life, he/she can earn his living by doing blogging.Thank you for this article.
tibco sportfire online training
Check their previous projects and the number of projects being done by them that are almost related to that of your project Salesforce training in Hyderabad
ReplyDeleteAre you looking for an AngularJS development company? Infotrench is the top AngularJS Development Company in Australia, UK, USA, Delhi, Noida, Gurugram, Ghaziabad, Faridabad. For more information please visit our website.
ReplyDeleteAngularjs Development Company
Hey, Nice one information
ReplyDeleteOnline IT Software Courses Training ICT South Bopal - Ahmedabad
Institute of Computer Training - ICT Bopal
Thanks for sharing all the information with us all.
ReplyDeleteData Science Online Training
Python Online Training
Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
ReplyDeletebest mulesoft online training
I am really happy to say it’s an interesting post to read. I learn new information from your article; you are doing a great job. Keep it up…
ReplyDeleteData Science Training in Gurgaon
Data Analytics Training in Gurgaon
Python Training in Gurgaon
Nice Blog !
ReplyDeleteHere We are Specialist in Manufacturing of Movies, Gaming, Casual, Faux Leather Jackets, Coats And Vests See Mayans MC Vest
I found some useful information from this article, thanks for sharing the useful information.
ReplyDeleteaws scope
aws networking certification
rpa blue prism
future scope of robotics
hadoop testing interview questions and answers for experienced
Oracle Corporation is an American multinational computer technology corporation headquartered in Redwood Shores, California.
ReplyDeletetally training in chennai
hadoop training in chennai
sap training in chennai
oracle training in chennai
angular js training in chennai
Great Blog…very useful.Thanks for sharing with us!
ReplyDeleteDevOps Training institute in Ameerpet
DevOps Training in Hyderabad
Learned a lot of new things in this post. Thanks for taking the time to share this blog...
ReplyDeletewhat does a devops engineer do
what is soft skill development
how to learn tableau
best way to improve spoken english
blue prism technical interview questions
blue prism interview questions for freshers
javascript basic interview questions
It's a really great and useful piece of information. Thanks, and please keep up the rewarding work. Usmle Step 1
ReplyDelete