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="[email protected]" 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!
style
attribute. – Graniahead
tag of the html, removing the scripts from the htmlbody
, I was with this problem in IE11 and FF and it solved my problem. If you still have this problem try this, and let us know. – Lactometer