Angular: Empty Fiddle
http://angularjs.org/
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script src="https://rawgit.com/akatov/angular-contenteditable/master/angular-contenteditable.js"></script>
<div ng-controller="Ctrl">
Hello, {{name}}!
<div contenteditable="TRUE" ng-model="text" class="" >
</div>
<p>
{{text}}
</p>
</div>
JavaScript
var myApp = angular.module('myApp', ['contenteditable']);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
myApp.controller('Ctrl', function($scope) {
$scope.name = 'Jignesh';
$scope.text = "Initial stuff with bold and italic yay";
$scope.$watch('text', function( newValue, oldValue ) {
if(newValue.indexOf("#") > -1)
{
var words = newValue.replace(' ',' ').split(' ');
var wordsNewArray = [];
angular.forEach(words, function(value){
if(value.indexOf('#')==0)
{
this.push('<b>' + value + '</b>');
}
else
this.push(value);
}, wordsNewArray);
var tagStr = wordsNewArray.join(' ');
$scope.text = tagStr + ' ';
}
});
});