im new to angular so im trying something new to get used to it.
I use socket.io to get a list of images [car1...car5] and i want to dynamically inject them to the view.
in my html i have a that looks like this:
<div id="section" ng-bind-html="HTML">
</div>
and in my core.js angular script i have:
var app = angular.module('test', []);
app.factory('socket', function () {
var socket = io.connect('http://localhost:8080');
return socket;
});
app.controller('TodoCtrl', function($scope, socket)
{
socket.emit('images', {}); //send for a list of images
socket.on('returnImages', function(data)
{
for(var i =1;i<=data.list.length;i++)
{
$scope.HTML = '<img style="left:'+(i*50)+'px;" src="/images/'+data.list[i]+'"/>';
}
$scope.$digest();
});
});
but this throws an error:
Error: [$sce:unsafe] http://ift.tt/1HJTijI etc
im following the docs so im not sure whats wrong and i tried including the angular-sanitize but I cant find the cdn link i keep getting a 404
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire