I'm picking up Angular JS at: http://www.sitepoint.com/practical-guide-angularjs-directives/, and I find that the following codes work in Chrome, but not IE 11.
<!DOCTYPE html>
<html ng-app="myapp">
<head>
<meta charset="utf-8" />
<title>No Title</title>
<script data-require="angular.js@1.2.x" src="http://code.angularjs.org/1.2.7/angular.js" data-semver="1.2.7"></script>
</head>
<body>
<input type="text" ng-model="color" placeholder="Enter a color..." />
<div data-hello-world />
<script>
var app = angular.module('myapp', []);
app.directive('helloWorld', function () {
return {
restrict: 'AE',
replace: true,
template: '<p style="background-color:{{color}}">Hello World!!</p>',
link: function (scope, elem, attrs) {
elem.bind('click', function () {
elem.css('background-color', 'white');
scope.$apply(function () { scope.color = "white"; });
});
elem.bind('mouseover', function () { elem.css('cursor', 'pointer'); });
}
}
});
</script>
</body>
</html>
Specifically, the mouseover and click events work fine. However, the paragraph's background color doesn't in IE (the color never changes). It's ok in Chrome. Thanks!
Hello World!!
', and it doesn't work in both IE and Chrome. I'm running out of quotes...! Both single and double quotes are already used. :( – Dunnomuch May 19 '14 at 07:55Hello World!!
' and it worked in both browsers. Thanks! – Dunnomuch May 19 '14 at 09:25Hello World!!
' doesn't work in both browsers. Don't escape too much, don't escape too little. What headache! – Dunnomuch May 19 '14 at 09:36