AngularJS supports .html(), .text() jQuery functionality. Here in below examples we can see how to set text or html to an element.

Steps to set text to an elemnt :

  1. Get angular element of html element
  2. Use .text() method to set text to that angular element
var myEl = angular.element( document.querySelector( '#divID' ) );
myEl.text('This is text. Here html tags will be displayed like normal tags. Example : <span style="font-weight:bold;"> Styled Text</span>');     

Set Text using ng-bind

ng-bind is for binding text to HTML element
<html ng-app="" ng-controller="myCtrl">
.....
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
.....
<input ng-model="divText"/>
.....
<div style="border:1px solid #ccc;padding:10px;" ng-bind="divText"></div>
<script>
function myCtrl($scope) {
  $scope.divText = 'some text';
}
</script>
Try It Your Self

Steps to set html to an element :

  1. Get angular element
  2. Use .html() method to set html to that angular element
var myEl = angular.element( document.querySelector( '#divID' ) );
myEl.html('This is html. Here html tags will be mixed with page. Example : <span style="font-weight:bold;"> Styled Text</span>');     

Set HTML using ng-bind-html

ng-bind-html is for binding HTML to element
<html ng-app="myApp" ng-controller="myCtrl">
.....
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-sanitize.js"></script>
.....
Enter some text in below text field <br/>
<input ng-model="divHtmlVar"/><br/><br/>
<div style="border:1px solid #ccc;padding:10px;" ng-bind-html="divHtmlVar"></div>
<script>
var myApp = angular.module('myApp', ['ngSanitize'])
function myCtrl($scope) {
    $scope.divHtmlVar = '<b>main html</b>';
}
</script>
Try It Your Self

94 comments:

  1. Good Example to Set Text or Html to div using AngularJS, i am interesting to learn AngularJs 4, give me more examples

    ReplyDelete
  2. Hi, great to see your website. I like the content and the research done behind every aspect of your blog. It looks great and very knowledgeable. Keep it up the good work. PCNSE questions answers

    ReplyDelete
  3. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    Best Devops Training in pune
    Data science training in pune | Data Science training institute in Pune

    ReplyDelete
  4. Nice post. Thanks for sharing! I want people to know just how good this information. It’s interesting content and Great work.
    Thanks & Regards,
    VRIT Professionals,
    No.1 Leading Web Designing Training Institute In Chennai.
    And also Those who looking for
    HTML courses training institutes in Chennai
    CSS courses training institutes in Chennai
    Bootstrap courses training institutes in Chennai


    ReplyDelete
  5. There are different definitions of product development depending on the services companies offer and how they market themselves. Check out this article to learn more about the product development companies.

    ReplyDelete




  6. And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had.
    software Testing Training |Best Software Training Institute in Chennai



    ReplyDelete
  7. www.excelr.com/digital-marketing-training
    digital marketing training
    I finally found great post here.I will get back here. I just added your blog to my bookmark sites. providing.

    ReplyDelete
  8. www.excelr.com/digital-marketing-training-in-hyderabad - digital maketing course in hyderabad
    I finally found great post here.I will get back here. I just added your blog to my bookmark sites. providing.

    ReplyDelete
  9. Nice blog, good post, informative and helpful post and you are obviously very knowledgeable in this field. Very useful and solid content. Thanks for sharing


    Data Science Courses in Bangalore

    ReplyDelete
  10. This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this..
    date analytics certification training courses
    data science courses training
    data analytics certification courses in Bangalore
    ExcelR Data science courses in Bangalore

    ReplyDelete
  11. Attend The Python Training in Bangalore From ExcelR. Practical Python Training in Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python Training in Bangalore.

    ReplyDelete
  12. This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
    machine learning course malaysia

    ReplyDelete
  13. I was just browsing through the internet looking for some information and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject. Bookmarked this page, will come back for more.
    data science course in singapore

    ReplyDelete

  14. It has fully emerged to crown Singapore's southern shores and undoubtedly placed her on the global map of residential landmarks. I still scored the more points than I ever have in a season for GS. I think you would be hard pressed to find somebody with the same consistency I have had over the years so I am happy with that.
    Thanks for sharing, live it.

    ReplyDelete
  15. Keep up the good work. Looking forward to view more from you.

    ReplyDelete

  16. Very interesting,good job and thanks for sharing such a good blog.your article is so convincing that I never stop myself to say something about it.You’re doing a great job.Keep it up.
    One data science
    One Machine Learning

    ReplyDelete

  17. Very interesting,good job and thanks for sharing such a good blog.your article is so convincing that I never stop myself to say something about it.You’re doing a great job.Keep it up.
    One data science
    One Machine Learning

    ReplyDelete
  18. You might comment on the order system of the blog. You should chat it's splendid. Your blog audit would swell up your visitors. I was very pleased to find this site.I wanted to thank you for this great read!!
    AI learning course malaysia

    ReplyDelete
  19. In our culture, the practice of treatment through various burn fat herbs and
    spices is widely prevalent. This is mainly due to the reason that different burn fat herbs grow in great abundance here. In addition to the
    treatment of various ailments these herbs prove beneficial in Healthy Ways To Lose Weight
    , especially for those who want to burn fat herbs

    we live in a world where diseases and their prevalence has gone off
    the charts. With the ever-growing incidences of illnesses and
    sufferings, one finds themselves caught up in a loop of medications
    and doctors’ visits. We, at https://goodbyedoctor.com/ , aim to find solutions for
    all your health-related problems in the most natural and harmless ways.
    We’re a website dedicated to providing you with the best of home
    remedies, organic solutions, and show you a path towards a healthy,
    happy life. visit https://goodbyedoctor.com/
    this site daily to know more about health tips and beauty tips.

    ReplyDelete
  20. I like you article. if you you want to saw Sufiyana Pyaar Mera Star Bharat Serials Full
    Sufiyana Pyaar Mera

    ReplyDelete

  21. Excelr is providing emerging & trending technology training, such as for data science, Machine learning, Artificial Intelligence, AWS, Tableau, Digital Marketing. Excelr is standing as a leader in providing quality training on top demanding technologies in 2019. Excelr`s versatile training is making a huge difference all across the globe. Enable ?business analytics? skills in you, and the trainers who were delivering training on these are industry stalwarts. Get certification on "
    best data science courses in hyderabad "
    and get trained with Excelr.

    ReplyDelete
  22. Attend The Data Analytics Courses in Bangalore with Placement From ExcelR. Practical Data Analytics Courses in Bangalore with Placement Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analytics Courses in Bangalore with Placement.
    ExcelR Data Analytics Courses in Bangalore with Placement

    ReplyDelete
  23. I am impressed by the information that you have on this blog. It shows how well you understand this subject.
    ExcelR Data Analytics courses

    ReplyDelete
  24. PhenQ Reviews - Is PhenQ a new Scam?
    Does it really work? Read this honest review and make a wise purchase decision. PhenQ ingredients are natural and ...
    It has been deemed fit for use in the market. It is not found to be a Scam weight loss pill.
    By far it is the safest and most effective weight loss pill available in the market today.

    Phenq reviews ..This is a powerful slimming formula made by combining the multiple weight loss
    benefits of various PhenQ ingredients. All these are conveniently contained in one pill. It helps you get the kind of body that you need. The ingredients of
    the pill are from natural sources so you don’t have to worry much about the side effects that come with other types of dieting pills.Is PhenQ safe ? yes this is completly safe.
    Where to buy PhenQ ? you can order online. you don`t know Where to order phenq check this site .

    visit https://mpho.org/ this site to know more about PhenQ Reviews.

    ReplyDelete
  25. Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates.
    courses on data analytics

    ReplyDelete
  26. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
    ExcelR Data Analytics Course

    ReplyDelete
  27. - private detectives spain
    - private investigators in Spain at the best price. When you are obtaining the
    services offered to you by a private investigator.

    - private detective spain
    - Ways to choose private detectives spain safely | Do not make a mistake in hiring a
    private detective spain . In the regular course of your life.

    - private detectives in spain
    Ways to choose private detective in Spain safely | Do not make a mistake in hiring a
    private detective in Spain. In the regular course of your life,

    - private detective in spain
    Ways to choose private detective in spain safely | Do not make a mistake in ...
    not need to hire the professional services of a private detective agency.

    - detectives in spain
    - Ways to choose detectives in spain safely | Do not make a mistake in hiring
    a private detective in Spain. In the regular course of your life,

    - private detectives agency in spain
    - Ways to choose private detectives agency in spain safely | Do not make a mistake in hiring a
    private detective in Spain. In the regular course of your life,

    - private investigators spain
    private investigators spain at the best price. When you are obtaining the
    services offered to you by a private investigator, it is important.

    - private investigators madrid
    private investigators madrid in the Community of Madrid.
    Finding a detective in the Community of Madrid is an easy task.

    Hire private detectives from here.

    For More Info Check private investigator Here.

    ReplyDelete
  28. http://karachipestcontrol. com/-Karachi Best Pest Control and Water Tank Cleaning Services.

    M/S. KarachiPestControl has very oldKarachi Pest Control Services Technical Pest Control workers
    thatfumigation services in Karachi live and add your space sevenfumigation in Karachi
    days every week.Pest services in karachiThis implies we are able toTermite Fumigation in Karachi
    be with you actuallytermite proofing in karachi quickly and keep our costs very competitive. an equivalent
    nativeUnique fumigation technician can see yourBed bugs fumigation in Karachi cuss management
    drawback through from begin to complete.Rodent Control Services Karachi Eco friendly technologies isWater tank cleaner in karachi
    also used.We are the firstWater Tank Cleaning Services in Karachi and still only professional water
    tank cleaning company in Karachi.With M/S. KarachiPestControlyou’re totallyBest Fumigation in karachi protected.


    Check Our Website http://karachipestcontrol. com/.

    ReplyDelete
  29. Gold and silver for life reviews.
    Thousands Across The Globe Using Mineshaft Bhindari gold and silver for life Training To Protect Their Wealth And Creating A Passive Income of 12% To 26.4% Per Year….


    Gold and silver for life reviews- How It Works?

    Minesh Bhindi created Gold and silver for life reviews because, after a long career in helping people grow their wealth through investment,
    he noticed something that he felt should benefit everyone. Since 2010, Gold and Silver for life has been helping people grow their wealth securely through strategic Investing in precious metals , gold and silver.
    As proud founder of Reverent Capital, a secure investment advisory firm, he consults with high net worth individuals from around the globe on the importance of secure
    investments in gold and silver

    Learn How to invest in gold from here kingsslyn.com now.

    ReplyDelete
  30. Buy Real Registered Passports|Drivers license(( noveltarydocuments4us@gmail.com) ID card|Visas|IELTS|TOEFL|Diplomas|Counterfeit(Whatsapp:.... +1(412)326-9821)
    Express Documents provide a second Chance In Life with New Identity protect your privacy, build new credit history, bypass criminal background checks, take back your freedom. We only offer original passports, driver's license, identity cards, visas, stamps for Australia,Germany, Belgium, Brazil, Finland, France, Great Britain, Ireland, Italy, Netherlands, Norway, Austria, Sweden, Switzerland, Spain, Great Britain, USA and some others. We offer you one of the best services in the world. Most customers have experienced our true and outstanding services.
    whatsapp :............. +1(412)326-9821Whatsapp:.............. +1(412)326-9821email:................. noveltarydocuments4us@gmail.comwebsite:.............. https://docsexperts.com

    ReplyDelete
  31. It's late finding this act. At least, it's a thing to be familiar with that there are such events exist. I agree with your Blog and I will be back to inspect it more in the future so please keep up your act.

    Digital marketing course mumbai

    ReplyDelete
  32. Wow such a informative post which i need to explain my team member who working on it - It's my pleasure to visit this post.
    allow us to introduce our self we are here to make your wedding perfect and special at wedding limo Parker

    ReplyDelete
  33. I am impressed by the information that you have on this blog. It shows how well you understand this subject.
    data science courses

    ReplyDelete
  34. Very nice job... Thanks for sharing this amazing and educative blog post! ExcelR Data Scientist Course In Pune

    ReplyDelete
  35. A great piece of writing! You have an efficient flair for high quality writing. I am highly impressed by your way of writing this content beyond words. I really have a lot of appreciation for your writing.
    SAP training in Kolkata
    Best SAP training in Kolkata
    SAP training institute in Kolkata

    ReplyDelete
  36. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries
    AWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery


    ReplyDelete
  37. I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon…
    Data Scientist Courses Super site! I am Loving it!! Will return once more, Im taking your food likewise, Thanks.

    ReplyDelete
  38. Thanks for explaining how to set HTML to div using angularjs. Your explanation is really wonderful. I am very happy to get this good one from your side. Always, I will be the backbone for your improvement.
    web designing in theni

    ReplyDelete
  39. It’s good to check this kind of website. I think I would so much from you. ExcelR Data Analytics Course

    ReplyDelete
  40. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. ExcelR Data Scientist Classes In Pune Any way I’ll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info.

    ReplyDelete
  41. Bangladesh Education Board Notice : Primary Admit Card, DGFOOD Admit Card, Food Admit Card Published on our official website : https://allresultsall.com/category/admit-card/

    ReplyDelete
  42. Bangladesh Education Board Result : PSC Result, SSC Result, HSC Result, CBSE Result, Honours Result, Master Result New Published on our website : https://allresultsall.com/category/results/

    ReplyDelete
  43. Very interesting blog. Many blogs I see these days do not really provide anything that attracts others, but believe me the way you interact is literally awesome.You can also check my articles as well.

    Rowe Rowe
    Rowe Rowe
    Rowe Rowe
    Rowe Rowe
    Rowe Rowe

    Thank you..

    ReplyDelete
  44. ترفند برد و آموزش بازی انفجار آنلاین و شرطی، نیترو بهترین و پرمخاطب ‌ترین سایت انفجار ایرانی، نحوه برد و واقعیت ربات ها و هک بازی انجار در
    اینجا بخوانید
    کازینو آنلاین نیترو
    بازی حکم آنلاین نیترو
    بازی حکم آنلاین
    Introducing the Nitro Blast game site
    معرفی سایت بازی انفجار نیترو
    همان طور که می دانید بازی های کازینو های امروزه از محبوبیت ویژه ای برخودارند که این محبوبیت را مدیون سایت های شرط می باشند. با گسترش اینترنت این بازی ها محدودیت های مکانی و زمانی را پشت سرگذاشته و به صورت آنلاین درآمده اند.
    بازی انفجار نیترو
    بازی انفجار
    یکی از محبوب ترین بازی های کازینو، بازی انفجار می باشد که ساخته سایت های شرط بندی می باشد و امروزه از طرفداران ویژه ای برخودار است. با گسترش اینترنت سایت های شرط بندی مختلفی ایجاد شده اند که این بازی را به صورت آنلاین ساپورت می کنند. یکی از این سایت ها، سایت معتبر نیترو می باشد. در این مقاله قصد داریم به معرفی
    سایت بازی انفجار نیترو بپردازیم.
    سایت پیش بینی فوتبال نیتر
    سایت پیش بینی فوتبال
    بازی رولت نیترو
    کازینو آنلاین

    Visit https://www.wmsociety.org/
    here for more information

    ReplyDelete
  45. NID Card Online Copy 2020 Recently Published. Government web: www.nidw.gov.bd. Candidate first & easily download NID Online Copy. Our website link : https://allresultsall.com/nid-online-copy-www-nidw-gov-bd/

    ReplyDelete
  46. cool stuff you have and you keep overhaul every one of us
    Data Analyst Course

    ReplyDelete
  47. Generic Latisse : Eyelashes drops 3ml with Bimatoprost 3%

    Natural Ways to Encourage eyelashes growth , iBeauty Care offers a wide variety of natural products for skin care

    iBeauty Care offers a wide variety of natural products for skin care, eyelashes growth, acne and many other health problems. All products are with clinically proven effects and great therapeutic results.
    Visit https://www.ibeauty care.com/home/21-generic-latisse.html here to buy this ar low cost.
    or visit The home page https://www.ibeauty-care.com/.

    ReplyDelete
  48. This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work. I have been meaning to write something like this on my website and you have given me an idea.
    Data Analyst Course

    ReplyDelete
  49. Im really impressed by it.I am happy for sharing on this blog its awesome blog I really impressed. thanks for sharing. Great efforts. data science training

    ReplyDelete
  50. This is exactly the information I'm looking for, I couldn't have asked for a simpler read with great tips like this... Thanks! ExcelR Data Analytics Courses

    ReplyDelete
  51. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspried me to read more. keep it up.
    salesforce training in chennai

    software testing training in chennai

    robotic process automation rpa training in chennai

    blockchain training in chennai

    devops training in chennai

    ReplyDelete
  52. I realized through this post how important angularjs is. I have been very interested in reading posts like this in my life.
    One Way Drop Taxi in Madurai | Web Development Company in Madurai

    ReplyDelete
  53. The overall look of your site is great, as well as the content!
    propose day messages
    valentines day images

    ReplyDelete
  54. Such a great content. I like your post. Really it was read so interesting. Thanks for sharing nice information. Golden Triangle Tour Package India

    ReplyDelete
  55. Thanks for making such a nice post about the set text or html to div using angularjs..
    web design company Jacksonville

    ReplyDelete
  56. This comment has been removed by the author.

    ReplyDelete
  57. Plumbing & HVAC Services San Diego
    Air Star Heating guarantees reliability and quality for all equipment and services.
    Air Star Heating is specializing in providing top-quality heating, ventilating, air conditioning, and plumbing services to our customers and clients.
    Our company is leading the market right now. By using our seamless and huge array of services. Our customers can now have the privilege of taking benefit from our services very easily and swiftly. To cope up with the desires and needs of our clients we have built an excellent reputation. We are already having a huge list of satisfied customers that seem to be very pleased with our services.

    Plumbing & HVAC Services in San Diego. Call now (858) 900-9977 ✓Licensed & Insured ✓Certified Experts ✓Same Day Appointment ✓Original Parts Only ✓Warranty On Every Job.
    Visit:- https://airstarheating.com

    ReplyDelete
  58. National University is published the nu honours 4th year exam result 2021 on online. Students now can check the result from nu.ac.bd/results as well as examresulthub.com

    ReplyDelete
  59. I'm excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read !! I definitely really liked every part of it.Educational Institute in Visakhapatnam

    ReplyDelete
  60. Thanks for sharing this exceptional and valuable information. It will help to improve our knowledge. Again thank you for sharing this marvelous data.
    <a href="https://www.modapkfile.com>Mod Apk store</a>

    ReplyDelete
  61. Your blogs are great. Are you also searching for nursing capstone writing project? we are the best solution for you. We are best known for delivering quality nursing capstone writing services to students without having to break the bank

    ReplyDelete
  62. Thanks for your efforts in sharing this post with us. This was really awesome. kindly keep continuing the great work.
    Data Science Training in Hyderabad
    Data Science Course in Hyderabad

    ReplyDelete
  63. Nice post. it is so good set text or html . I'm impressed! Extremely useful information. Thank you and keep up the good work. whatsapp mod

    ReplyDelete
  64. Hi to everybody, here everyone is sharing such knowledge, so it’s fastidious to see this site, and I used to visit this blog daily business analytics course in kanpur

    ReplyDelete
  65. At Market Forex Net , we believe in honesty, transparency and trust. We started Market Forex net to educate traders and help them with their trading techniques. We publish reviews of brokerages, strategies, investment tips, guides and much more.

    ReplyDelete
  66. Check The Gmhi Stock Overview To Monitor A Stock And View Live Price Changes As They Occur, Including Volume And Share Changes. With Our Live, Real Time Stock Market Overview App, You No Longer Need To Refresh Your Browser Or Watch Multiple Computer Screens To View Real Time Stock Prices.

    ReplyDelete
  67. I'm hoping you keep writing like this. I love how careful and in depth you go on this topic. Keep up the great work data analytics course in kanpur

    ReplyDelete
  68. Thank you very much for sharing such a great article. Great post I must say and thanks for the information. Education is definitely a sticky subject. Very informative. Take care. Digital marketing training

    ReplyDelete
  69. This is a fabulous post I seen because of offer it. It is really what I expected to see trust in future you will continue in sharing such a mind boggling post data science course in kanpur

    ReplyDelete
  70. Always so interesting to visit your site.What a great info, thank you for sharing. this will help me so much in my learning business analytics course in kanpur

    ReplyDelete
  71. Thank you so much for ding the impressive job here, everyone will surely like your post. data science training in kanpur

    ReplyDelete
  72. Very nice article. I enjoyed reading your post. very nice share. I want to twit this to my followers. Thanks !. business analytics course in surat

    ReplyDelete
  73. Here at this site really the fastidious material collection so that everybody can enjoy a lot. data analytics course in kanpur

    ReplyDelete
  74. I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!.. business analytics course in mysore

    ReplyDelete
  75. Good to visit your weblog again, it has been months for me. Nicely this article that i've been waiting for so long. I will need this post to total my assignment in the college, and it has exact same topic together with your write-up. Thanks, good share.
    data science training institute in hyderabad

    ReplyDelete
  76. I 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! business analytics course in mysore

    ReplyDelete
  77. This post is so interactive and informative.keep update more information...
    SEO Training in Tambarama
    SEO Training in Chennai

    ReplyDelete
  78. Nice blog post so thanks a lot for sharing this great blog post.. keep more post for sharing.. have a nice day.
    Apply for Super Visa Canada

    ReplyDelete

Blogroll

Popular Posts