Last active
January 3, 2016 12:28
-
-
Save rettal/8462662 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html data-ng-app="DemoApp"> | |
<head> | |
<meta charset="utf-8"> | |
<body> | |
<div class="container" data-ng-controller="SimpleController"> | |
Name: | |
<br /> | |
<input type="text" data-ng-model="name" /> {{name}} | |
<br /> | |
<p data-ng-repeat="cust in customers | filter:name"> | |
<div data-ng-bind-html="cust.name"></div> | |
</p> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular-sanitize.js"></script> | |
<script> | |
var demoApp = angular.module('DemoApp', ['ngSanitize']); | |
function SimpleController($scope) { | |
$scope.customers = [ | |
{name: "<b>Daniel Stokes</b>", city:'Manchester'}, | |
{name:'Paul Smith',city:'London'}, | |
{name:'Gary Brown',city:'Dublin'}, | |
{name:'Jon Doe',city:'Cardiff'} | |
] | |
} | |
demoApp.controller('SimpleController', SimpleController); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I posted this as I was struggling to output any HTML, found a solution here:
http://stackoverflow.com/questions/18340872/how-do-you-use-sce-trustashtmlstring-to-replicate-ng-bind-html-unsafe-in-angu
(I used the second solution , NOT the chosen answer)