I know angular has stopped supporting IE8 in version 1.3, but with the introduction of the one-way binding it's the only thing at the moment that seems to be breaking my page. I've successfully loaded version 1.2.9 for IE8 only and have every other browser uses 1.3, but the issue I am facing at the moment is that the one way bindings "::" are still being written/displayed out in the html. So what I am trying to figure out is a way that I can run a search and replace function over the html to remove the "::" in IE8 before angular runs?
Current bindings look like:
{{ ::day.Stuff }}
What I would like to them look like before angular runs
{{ day.Stuff }}
Here's a build of Angular 1.3 with IE8 support: https://github.com/fergaldoyle/angular.js-ie8-builds
So you won't have to load a different versions of Angular for different browsers.
Not that it would not be a solution to replace every ::
binding, but I don't think it would be an efficient one or pretty for that matter. If IE8 support is crucial for you, I would suggest using this very popular bind once library: https://github.com/Pasvaz/bindonce. I've used it before 1.3 came along and it served me well.
you could use regex in directive to do it quite simple actually. Make sure set terminal to true, if not it will return error.
angular.module('fixme').directive('regexDirective', function ($compile) {
return {
restrict: 'AE',
terminal:true,
link: function(scope, element, attr) {
var dirty = element[0].innerHTML;
var str = dirty.replace(/[::]/g, "");
var ele = $compile('<div>'+str+'</div>')(scope);
element.replaceWith(ele);
}
}
})
in the controller.
angular.module('fixme', []).controller('demoController', ['$scope', function($scope) {
$scope.day = {Stuff: 'boring'}
//console.log($scope.day.Stuff)
}]);
in html
<body ng-controller="demoController">
<div regex-directive>{{ ::day.Stuff }}</div>
</body>