I have a small error in one of my scripts working with the sun and angular
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Welcome to LearnKode - A code learning platform</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
</head>
<body ng-app="app">
<div ng-controller="elementController">
<div id="testDiv">
<p>error de angular</p>
<p>{{name}}</p>
<p>error de angular</p>
</div>
</div>
</body>
</html>
<script>
var app = angular.module("app", []);
app.controller('elementController', ['$scope', '$document',
function($scope, $document) {
$scope.name = "LearnKode";
var element = angular.element($document[0].querySelector('#testDiv'))
element.append("<h2>Append</h2>");
element.prepend("<h2>Prepend</h2>");
}
]);
</script>
Look at the three elements <p>
of the html where I put "angular error". The variable name
does not compile to me for being within the labels that I manipulate with angular, nevertheless if I take out of the div the 'p' of means where it says 'name', then if it works to me, it seems to me a strange thing, no ? Note even that the first 'p' does not execute it. Do not you think it is weird angular gentlemen?