I’ve got an ng-include and ng-controller within an ng-repeat, and IE randomly craps itself when it sees the child instance object of the repeat:
inside main.html
<section ng-repeat="panel in sidepanels">
<h2 class="twelve columns">
<span class="twelve">
<i class="icon {{panel.icon}}"></i> <!-- resolves properly -->
{{panel.controller.name}} <!-- empty -->
</span>
</h2>
<div
ng-include src="'views/'+panel.controller.name.toLowerCase()+'.html'"
ng-controller="panel.controller"
></div>
</section>
inside controllers.js
function Main($scope) {
…
$scope.sidepanels = [
{
"controller": Alerts,
"icon": "icon-warning-sign"
}
];
…
}
function Alerts($scope,WebSocket) {
$scope.alerts = [];
WebSocket.on('…', function(data) { … });
WebSocket… //WebSocket is a Service
}
Except instead of throwing an error in console, it just silently ignores the fact that it sometimes can’t resolve panel. I only noticed this was the case because I saw a failed GET on views/.html.
I checked MSDN, and supposedly IE supports the name property.
The property
namedoesn’t work very well for functions on IE.You can use the following snippet to retrieve a function’s name (as described here):
Add a function to your
Maincontroller that creates the template path, like this:And on the HTML:
jsFiddle: http://jsfiddle.net/bmleite/faGRk/