So I am fairly new to both of these technologies. My plan was to implement the Peepcode Tunes project that they made with Backbone ( https://github.com/philipkobernik/backbone-tunes ) with MeteorJS and then try implementing it using MeteorJS with the AngularJS addon. Someone has already done it all in just Angular: https://github.com/angular/peepcode-tunes
Most things went pretty smoothly. You can see what I have so far at:
Just Meteor: https://github.com/Jonovono/Meteor-peepcode-tunes Meteor and AngularJs: https://github.com/Jonovono/Meteor-angular-peepcode-tunes
I really enjoy working with Angular and being able to pass things from the view like:
ng-click="pl.add(album)">
Which seems more complicated when just using Meteor.
However one question I am having. Say I want to save the playlist every time a album is added/removed. So that if the page is refreshed it still is there. I don't know the best way to do this and when using AngularJS with Meteor I am confused how this should be done.
Right now when using Angular and Meteor I do something like this:
$scope.Playlist = new Meteor.AngularCollection("playlist", $scope);
$scope.playlist = $scope.Playlist.findOne({});
$scope.pl.add = function(album) {
if ($scope.playlist.indexOf(album) != -1) return;
$scope.playlist.push(album);
$scope.playlist.$save();
};
However that does not seem to save it to the database. But if I were to do something like:
album.title = "CHANGED"
album.$save()
It seems like it would save this to the database.
I am sure I am just missing something small in regards to Meteor or the AngularJS add on to it. Any enlightenment would be awesome!
Creator of the bridge here. Did you pull the latest version from github? I haven't updated the version on atmosphere yet. Sorry for that . .findOne needs some extra code will push it this evening.
https://github.com/lvbreda/Meteor_angularjs
Creator of the new bridge here :)
As the old bridge is no longer maintained our team wrote and is actively maintaining this library - angular-meteor and we've also released a tutorial for combining the two - angular-meteor tutorial
Would love to hear your thoughts!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With