Using Spark.publish() with Simple JSON Data

Hi again,

@andreh posted an amazing WEBAPP written in Angular Here. I modified the files to work for my project. He has however been missing on the forum and i desperately need some help with getting my publish events working. I am a novice at everything programming. His app.js file has a function for events built into it.

 /** Register a handler which will be called for each incoming event from any owned device. */
        registerMineEvents: function(handler) {
            this.registerDeviceEvents('mine', handler);
        },

        publishEvent: function(event) {
            return $http.post(baseUrl + '/devices/events', event);
        }
    }
});

and he uses ng-repeat to show all the events in a list format.

 <div ng-show="events[device.id] && events[device.id].length > 0">
                            <h3>Events</h3>
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th class="hidden-xs">Time</th>
                                        <th>Event</th>
                                        <th>Data</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="event in events[device.id]">
                                        <td class="hidden-xs">{{event.published_at}}</td>
                                        <td>{{event.name}}</td>
                                        <td>{{event.data}}</td>
                                       
                                    </tr>
                                </tbody>
                            </table>
                        </div>                        

What if i want to show specific events by themselves instead of them creating sequential duplicates and update those events whenever a new value is pushed as per the programming in Photon. Kind of like the tutorial you did.

Any help will be greatly appreciated as i am quite stuck.