Richard Searle


Angular, SSE and modifying a list model

08 Apr 2012

The previous example used a very simple model, consisting of a single String. A more realistic implementation would add the strings to a list.
<body ng-app>
 <div ng:controller="Main">
 <li ng:repeat="item in items">

<script type='text/javascript'>//<![CDATA[

var source = new EventSource('/events');

function Main($scope) {
 $scope.items = [];

source.addEventListener('right', function(e) {
 $scope.$apply(function() {