I'm receiving messages from a server using socket.io and adding them to the $scope.event
array each time a message is received. How can I update the directive isolated scope's message
value when a message is received in the controller? It doesn't seem to be working with the code below.
directive.js
angular.module("App").directive('progressBarCustom',function () {
return {
restrict: 'E',
scope:{
message: "=",
fileSize: "=",
},
templateUrl: '/view/partials/progressbar.html',
controller: "StCtrl",
link: function(scope, el, attrs) {
var data = scope.message;
}
});
main.html
<ul style="list-style: none;">
<li ng-repeat="message in event track by $index" ng-class="{lastItem: $last}"><span><strong>Log:</strong></span><span>{{message}}</span></li>
</ul>
ctrl.js
socket.on('ditConsumer',function (data) {
$scope.event.push(data);
}
$scope.event = ["lorem ipsum","lorem ipsum"];
template.html
<progress-bar-custom ng-show="progressBarFlag" message="event" file-size="selectedFileSize"></progress-bar-custom>