I want to replace sometext by defined text with the help of angular JS. My html is
<!DOCTYPE html>
<html>
<head>
<title>Directive</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body ng-app="myApp">
<div hello-world>sometext</div>
</body>
</html>
and JS is
var app = angular.module('myApp', []);
app.directive('helloWorld', function() {
return {
restrict: 'AE',
replace: 'true',
template: '<input type="text" ng-model="headline"/><br/>{{headline}}'
};
});
My browser says that,
Error: [$compile:tplrt] Template for directive 'helloWorld' must have exactly one root element....
How to solve this. Thank you.