In this tutorial, I am going to explain you about ng-bind-html directive in Angular Js. In the previous session, we have discussed ng-bind directive in Angular Js.

Introduction:

The ng-bind-html directive in angular js is used to bind the content to HTML element in a secure way. When we allow the HTML to our application. We need to make sure the HTML for the dangerous code. To prevent the HTML from dangerous code to we need to include the angular-sanitize.js library in our application. We can do by running our code through ngSanitize function.

ng-bind-html

You can find the angular-sanitize.js library at this location:

https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-sanitize.js

Here is the Syntax for declaring ng-bind-html:
<element ng-bind-html=”expression”></element> Where

Expression:  Specifies a variable, or an expression to evaluate.

An example of ng-bind-html in Angular Js:

<!DOCTYPE html>
<html>
<title>ng-bind-html example</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-sanitize.js"></script>
<body>

<div ng-app="myApp" ng-controller="myCtrl">

<p ng-bind-html="myText"></p>

</div>

<script>
var app = angular.module("myApp", ['ngSanitize']);
app.controller("myCtrl", function($scope) {
$scope.myText = "Welcome to: <h1>Debug On Web</h1>";
});
</script>

<p><b>Note:</b> In this example i includes the "angular-sanitize.js",
which has functions for removing potentially dangerous tokens from the HTML.</p>

</body>
</html>


 

You can find the demo of this example from here

Hope you understand this tutorial about how to prevent HTML from dangerous code.

You must read my previous article:

Thank You,

54 Comments

  • Hi,

    I am contacting you today because i have Jackpotbetonline.com site for advertising.

    Please check the website where you place link or article post.

    Jackpotbetonline.com are evryday updated & have good Domain Autority (DA=62) & Good Domain Rating (DR=72).

    The Following advertising Options are available:

    Text Link Space
    Article post (Max of 3 links per article)
    Advertising Banner Space (460×60 or 250×250)
    Best ” Online casino Slots ” Review

    Regards,

  • InstaFollowers
    Instafollowers.co is a corporate and trusted website that provides services to improve your account on Social Media platforms like Instagram, Twitter, Facebook, TikTok, YouTube and provides professional SEO services to websites.
    https://www.instafollowers.co

    Why Are Instagram Followers Important?
    Buying Instagram followers helps your account get more visibility since Instagram has more than one billion users around the world, and it is one of the most popular social media platforms. There is no doubt that it is a highly preferred platform nowadays because it offers a very user-friendly interface. Although it was seen as a copy of the famous Snapchat back in the day, Instagram developed itself quickly. It offered so many features that people can’t even stay away from using them. In addition, Instagram came up with so many creative features that caught Facebook’s interest. That is the reason why they bought it in 2012, and now it is a sub-company of Facebook. It was a clever investment, in fact. As we could see, Facebook is still managing to keep its popularity, with different platforms such as Instagram and WhatsApp.

    After Facebook bought Instagram, the app even got better. Instagram offered a lot of features, and its user-friendly interface made the app very popular. In fact, the most popular. However, features and interface are not the only reason why the app is so popular. It also gave people the chance to become famous. That is why Instagram followers are very important. Without an audience, there wouldn’t be popular Instagram personalities. This is the reason behind people wanting to buy Instagram followers.

    The number of followers you have on Instagram matters, just like any other social media platform. If your account has many followers, it gets easier to get more followers progressively by time. Of course, you can try to increase the number of your followers in natural ways. There are many pieces of advice and ways to get more followers on Instagram. Although they are true, you may not have time to get success on your social media experience. That is why considering buying followers is a good idea, and it is considered as a quick boost to the number of followers you wish.

    Key Reasons to Buy Instagram Followers
    When we started using social media in its early times, it was purely for entertainment. Yet, social media is not just about that anymore. Today, we can see many brands, companies, and other organizations using social media for a profit purpose. Since Instagram became a popular platform, we can see various types of uses of it, either for entertainment or for business purposes.

    Instagram even offers business profiles if you want to use it for making money and promoting your brand. Just like a basic account, you can create and manipulate it easily. Instagram supports all of its users by offering the same easy user experience. Business profiles are great to promote your work, and as a regular profile, you can buy followers for it.

    Benefits of Buying Instagram Followers
    Buying followers will save you time to grow your account. You may desire to do it in an organic way. However, it is not always possible. Let’s say you have opened a souvenir shop, and you want to promote it. Instagram is a perfect way to do so. However, you have made a lot of investment for that store, and you want to start making money as soon as possible. If you try to gain followers organically, you will need to spend time on it between all of your work. That is why buying followers will help you, but how?

    We have mentioned that buying Instagram followers is a good way to grow your account quickly. Here are some advantages that are obtained by buying followers:

    How Can You Buy Followers?
    Buying IG followers from InstaFollowers is very easy and also very safe. We don’t need any vital information such as your password etc. We don’t make you fill out any forms or write many things, either. With our tool, you can buy followers easily and fast. You can see the instructions below:

    You will see two boxes; you need to write your Instagram profile name to the first one.
    Then, write the number of followers you want for that profile to the second box.
    You can see the estimated delivery time and the amount of the fee for your followers.
    Finally, click on ‘Buy Now’ or ‘Add to Cart’ to end the process.

  • Продажи с помощью Pinterest http://1541.ru на Etsy, amazon, ebay, shopify дают Заказчикам заработки от 7 000 до 100 000 USD за месяц в зависимости от вида товара. Приоритет handmade.Facebook, instagram,google ads – отстой по сравнению c пинтерестом в 99%

  • С каждым часом доступ из России к сайтам онлайн казино становится сложнее. Постоянные блокировки зеркал казино привело к тому, что стало появляться большое количество фейковых сайтов с казино зеркалами. Делюсь одним из немногих настоящих сайтов казино зеркал с проверенными зеркалами казино.

  • Продажи с помощью Pinterest http://1541.ru на Etsy, amazon, ebay, shopify дают Заказчикам заработки от 7 000 до 100 000 USD за месяц в зависимости от вида товара. Приоритет handmade.Facebook, instagram,google ads – отстой по сравнению c пинтерестом в 99%

  • Добрый день.
    Порекомендуйте хорошую онлайн-типографию для заказа брошюр
    Мы работали с одной типографией, качество, цена и скорость у них хорошее,
    но они находятся в Красноярске, а мне нужно в Казани.
    Это печать хенгеров https://kraft-pt.ru/products/doorhangers

  • Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!

  • Great – I should definitely pronounce, impressed with your web site. I had no trouble navigating through all tabs as well as related information ended up being truly simple to do to access. I recently found what I hoped for before you know it in the least. Quite unusual. Is likely to appreciate it for those who add forums or anything, site theme . a tones way for your customer to communicate. Nice task..

  • Балясины для лестниц от производителя! https://balyasiny-optom.ru/ Изготовим балясины и ножки для мебели любой формы: точеные, граненые, витые, резные, комбинированные (дерево + металл) из сосны, дуба, бука, ясеня. Токарные станки с ЧПУ, быстрая и качественная обработка. Шлифовка под покраску

  • Всем привет белокожие друзья, нашла очнь интересный сайт, любителей животных.
    А увас есть такие фантазии по поводу вязки с человеком? напиши мне,хочу найти таких же людей чтоб вместе эксперементировать.
    Желательно с умелым кобельком. Ятемненькая девушка с афрканскими корнями, сейчас живу в России. Во например
    ебля с животными Прошу администрацию строго не судить, мы живём один раз и я хочу попробовать: ))

  • Доброго времени суток
    Если у кого то есть проблемы с мужским здоровьем то заходите по ссылке
    Сиалис Приобрести с доставкой. Загляните на наш хаб

    Means for improving male strength. Increase in potency and prolongation of sexual intercourse. Come to us.
    https://potentia24.online/

    1e9c1a255f36442aa274ee111a22155c

  • Добрый день, коллеги.
    Если вам нужен квалифицированный адвокат в Днепре, можете нам довериться. Как показывает практика, в большинстве дел, в которых принимали участие наши адвокаты, суд выносил решение в пользу наших клиентов. Кроме того, мы предоставляем профессиональные юридические консультации в телефонном режиме. Наша компания работает по следующим направлениям: гражданские, семейные, хозяйственные дела, ДТП, защита в уголовном процессе.

  • Лечебная физкультура дома. Массажер-тренажер Backwood https://youtu.be/OcK8Rdv9Y-I Специалист по реабилитации и висцеральной практике

  • Hello this is kinda of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding experience so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!|

  • Лечебная физкультура дома. Массажер-тренажер Backwood https://youtu.be/OcK8Rdv9Y-I Специалист по реабилитации и висцеральной практике

  • Хорошего дня.
    Подскажите нормальную типографию для печати буклетов
    Я нашел одну, качество, цена и скорость у них хорошее,
    но они размещаются в Красноярске, а мне нужно в Москве.
    Вот печать папок https://4uprint.ru/products/papki