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

53 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. The great service in this blog and the nice technology is visible in this blog. I am really very happy for the nice approach is visible in this blog and thank you very much for using the nice technology in this blog
    Angularjs course in chennai

    ReplyDelete
  3. 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
  4. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.

    rpa training in bangalore | best rpa training in bangalore | rpa course in bangalore | rpa training institute in bangalore | rpa training in bangalore | rpa online training | rpa training in Chennai

    ReplyDelete
  5. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    python course in pune
    python course in chennai
    python Training in Bangalore

    ReplyDelete
  6. 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
  7. When I initially commented, I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment. Is there any way you can remove people from that service? Thanks.
    Amazon Web Services Training in Pune | Best AWS Training in Pune
    AWS Online Training | Online AWS Certification Course - Gangboard
    Top 110 AWS Interview Question and Answers | Advanced AWS interview Questions and Answers – AWS jobs

    ReplyDelete
  8. 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
  9. 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




  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. Super site! I am Loving it!! Will return once more, Im taking your food additionally, Thanks.
    Data Science Course in Pune

    ReplyDelete

  16. This is really good blog information thanks for sharing .I am really impressed with your writing abilities

    โปรโมชั่นGclub ของทางทีมงานตอนนี้แจกฟรีโบนัส 50%
    เพียงแค่คุณสมัคร Gclub กับทางทีมงานของเราเพียงเท่านั้น
    ร่วมมาเป็นส่วนหนึ่งกับเว็บไซต์คาสิโนออนไลน์ของเราได้เลยค่ะ
    สมัครสล็อตออนไลน์ >>> goldenslot
    สนใจร่วมลงทุนกับเรา สมัครเอเย่น Gclub คลิ๊กได้เลย

    ReplyDelete
  17. I am really impressed with your post thank you for information


    เว็บไซต์คาสิโนออนไลน์ที่ได้คุณภาพอับดับ 1 ของประเทศ
    เป็นเว็บไซต์การพนันออนไลน์ที่มีคนมา สมัคร Gclub Royal1688
    และยังมีหวยให้คุณได้เล่น สมัครหวยออนไลน์ ได้เลย
    สมัครสมาชิกที่นี่ >>> Gclub Royal1688
    ร่วมลงทุนสมัครเอเย่นคาสิโนกับทีมงานของเราได้เลย

    ReplyDelete
  18. 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

  19. I am a new user of this site so here i saw multiple articles and posts posted by this site,I curious more interest in some of them hope you will give more information on this topics in your next articles.

    Data Science Course

    ReplyDelete
  20. 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
  21. 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

  22. 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
  23. I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article.
    Thank you for your post, I look for such article along time, today i find it finally. this post give me lots of advise it is very useful for me.
    It should be noted that whilst ordering papers for sale at paper writing service, you can get unkind attitude. In case you feel that the bureau is trying to cheat you, don't buy term paper from it.
    Data Science Courses

    ReplyDelete
  24. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us

    You will get an introduction to the Python programming language and understand the importance of it. How to download and work with Python along with all the basics of Anaconda will be taught. You will also get a clear idea of downloading the various Python libraries and how to use them.
    Topics
    About ExcelR Solutions and Innodatatics
    Do's and Don’ts as a participant
    Introduction to Python
    Installation of Anaconda Python
    Difference between Python2 and Python3
    Python Environment
    Operators
    Identifiers
    Exception Handling (Error Handling)
    Excelr Solutions

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

    ReplyDelete

  26. 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

  27. 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
  28. 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
  29. I love your article so much. Good job
    ExcelR is a global leader delivering a wide gamut of management and technical training over 40 countries. We are a trusted training delivery partner of 350+ corporate clients and universities across the globe with 28,000+ professionals trained across various courses. With over 20 Franchise partners all over the world, ExcelR helps individuals and organisations by providing courses based on practical knowledge and theoretical concepts.

    Excelr Solutions

    ReplyDelete
  30. Sehar News is a wide area that envelops pakistan news , kashmir news , International News, Sports News, Arts and
    Entertainment News, Science and Technology, Business News, latest news in urdu , Education News and today news Columns.
    The perusers can snatch most recent urdu news dependent on different political and get-together
    occurring in the nation. Sehar News covers the most recent and up and coming news features, Read today urdu news and top stories from different backgrounds and carries it to the viewers



    wanna know latest pakistan news ? click pakistan news and know more.

    Read latest news in urdu and know more .

    read all the latest urdu news in this site.

    you dont know ? about today news click here and know more.

    know the current news of kashmir news check here.

    read all about today urdu news and gain knowledge.

    ReplyDelete
  31. Established in 2016 SSDWebHosting.net is providing top quality domain and hosting services worldwide to
    our valued customers and trying to play a little role in their success.We offer about 500 distinctive gTlds and ccTlds
    to look over which includes old master class gTlds like .com, .net and .org, in addition this we also offer newly launched Tlds
    like .xyz, .online, .master, .office, .on, .top and .club. We can assist you with choosing the best fitting name. Let's bring your
    thought or business on the web. visit this site https://SSDWebHosting.net/ to know more.


    Do you wanna buy SSD Web Hosting visit here.
    Find best Cheap Web Hosting here.

    ReplyDelete
  32. punaise des lits sont l'un des problèmes les plus difficiles à éliminer rapidement.
    La meilleure solution, de loin, pour lutter contre punaise des lits est d'engager une société de lutte antiparasitaire.
    ayant de l'expérience dans la lutte contre punaise des lits . Malheureusement, cela peut être coûteux et coûteux.
    au-delà des moyens de beaucoup de gens. Si vous pensez que vous n'avez pas les moyens d'engager un professionnel
    et que vous voulez essayer de contrôler traitement des punaises de lit vous-même, il y a des choses que vous pouvez faire. Avec diligence
    et de patience et un peu de travail, vous avez une chance de vous débarrasser de punaises de lit paris dans votre maison.


    Vous voulez supprimer punaise des lits de votre maison ?
    se débarrasser de punaises de lit paris cocher ici
    nous faisons traitement des punaises de lit de façon très professionnelle.

    ReplyDelete
  33. 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
  34. Ez battery reconditioning reviews - You can now easily revive your old batteries with this
    Ez battery reconditioning pdf which provides step by step instructions for recondition a battery.
    Ez battery reconditioning blog publishes how Ez battery reconditioning programs works
    and where buy Ez battery reconditioning step by step program online after this
    candid Ez battery reconditioning reviews. Battery reconditioning course is newbie friendly. It may help you
    set up and run your own battery reconditioning business by learning this skill at home.
    How to recondition a battery with Ez battery reconditioning .
    Have you heard about Tom Ericson's Ez battery reconditioning reviews technique and
    are wondering whether it is possible or not. visit https://ezbatteryreconditioninginfo.com/ this site to know more. Thank you every one.

    ReplyDelete
  35. Nice Post...I have learn some new information.thanks for sharing.
    Click here for ExcelR Business Analytics Course

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

    ReplyDelete
  37. Tech Gadgets reviews and latest Tech and Gadgets news updates, trends, explore the facts, research, and analysis covering the digital world.
    You will see Some Tech reviews below,

    lg bluetooth headset : You will also wish to keep design and assorted features in mind. The most essential part of the design here is the buttonsof lg bluetooth headset .

    Fastest Car in the World : is a lot more than the usual number. Nevertheless, non-enthusiasts and fans alike can’t resist the impulse to brag or estimate according to specifications. Fastest Car in the World click here to know more.

    samsung galaxy gear : Samsung will undoubtedly put a great deal of time and even more cash into courting developers It is looking for partners and will allow developers to try out
    different sensors and software. It is preparing two variants as they launched last year. samsung galaxy gear is very use full click to know more.

    samsung fridge : Samsung plans to supply family-oriented applications like health care programs and digital picture frames along with games It should stick with what they know and they
    do not know how to produce a quality refrigerator that is worth what we paid. samsung fridge is very usefull and nice product. clickcamera best for travel: Nikon D850: Camera It may be costly, but if you’re trying to find the very best camera you can purchase at this time, then Nikon’s gorgeous DX50 DSLR will
    probably mark each box. The packaging is in a vibrant 45.4-megapixel full-frame detector, the picture quality is simply wonderful. However, this is just half the story. Because of a complex 153-point AF system along with a brst rate of 9 frames per minute. camera best specification. click here to know more.

    ReplyDelete

  38. 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
  39. 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 "
    data science training institute in hyderabad
    "
    and get trained with Excelr.

    ReplyDelete
  40. 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
  41. traitement punaises de lit paris sont l'un des problèmes les plus difficiles à éliminer rapidement.
    La meilleure solution, de loin, pour lutter contre traitement punaises de lit paris est d'engager une société de lutte antiparasitaire.
    ayant de l'expérience dans la lutte contre traitement punaises de lit paris . Malheureusement, cela peut être coûteux et coûteux.
    au-delà des moyens de beaucoup de gens. Si vous pensez que vous n'avez pas les moyens d'engager un professionnel
    et que vous voulez essayer de contrôler traitement des punaises de lit vous-même, il y a des choses que vous pouvez faire. Avec diligence
    et de patience et un peu de travail, vous avez une chance de vous débarrasser de traitement punaises de lit dans votre maison.

    Vous voulez supprimer traitement punaises de lit paris de votre maison ?
    se débarrasser de traitement punaises de lit paris cocher ici
    nous faisons traitement des punaises de lit de façon très professionnelle.

    OR Contract Here Directly:-

    email : Sansnuisibles@gmail.com
    Address: 91 Rue de la Chapelle, 75018 Paris
    number : 0624862470

    ReplyDelete
  42. Ez battery reconditioning reviews - You can now easily revive your old batteries with this
    Ez battery reconditioning pdf which provides step by step instructions for recondition a battery.
    Ez battery reconditioning blog publishes how Ez battery reconditioning programs works
    and where buy Ez battery reconditioning step by step program online after this
    candid Ez battery reconditioning reviews. Battery reconditioning is newbie friendly. It may help you
    set up and run your own battery reconditioning business by learning this skill at home.
    How to recondition a battery with Ez battery reconditioning .
    Have you heard about Tom Ericson's Ez battery reconditioning reviews technique and
    are wondering whether it is possible or not. visit https://ezbatteryreconditioninginfo.com/ this site to know more. Thank you every one.

    ReplyDelete
  43. 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
  44. This is an awesome blog. Really very informative and creative contents. This concept is a good way to enhance the knowledge. Thanks for sharing.
    ExcelR business analytics course

    ReplyDelete
  45. Really thanks for sharing...This blog is awesome very informative..
    ExcelR Machine Learning

    ReplyDelete
  46. Awesome..I read this post so nice and very imformative information...thanks for sharing
    Click here for data science course

    ReplyDelete

Blogroll

Follow this blog by Email

Popular Posts