Wednesday, 15 January 2014

line breaks in string while binding it with angularjs -



line breaks in string while binding it with angularjs -

i have problem in giving line break in string while binding info in angularjs

<h3 ng-bind="thirdcontainheaderonetitle"></h3> $scope.thirdcontainheaderonetitle = "my + '<br>' + hdjsd";

the <br>,'<br>',' \/n' not working , dont know why..

see https://docs.angularjs.org/api/ng/directive/ngbindhtml along posted example:

view:

<div ng-controller="ngbindhtmlctrl"> <p ng-bind-html="myhtml"></p> </div>

application:

angular.module('ngbindhtmlexample', ['ngsanitize']) .controller('ngbindhtmlctrl', ['$scope', function ngbindhtmlctrl($scope) { $scope.myhtml = 'i <code>html</code>string <a href="#">links!</a> , other <em>stuff</em>'; }]);

note need include ngsanitize module.

string angularjs line break

No comments:

Post a Comment