I'm trying to add a new object to my firebase model. Below is my Angularfire setup:
angular.module('angularApp', ['firebase'])
.controller('MyCtrl', ['$scope', 'angularFire',
function MyCtrl($scope, angularFire) {
$scope.shapes = [];
var ref = new Firebase('https://angular-starter.firebaseio.com/shapes');
angularFire(ref, $scope, 'shapes');
$scope.addShape = function () {
console.log(typeof $scope.shapes);
var newShape = {color: "#536993", height: 0, id: 1, left: 0, position: "absolute"};
$scope.shapes.push(newShape);
};
}
])
I understand that object don't have a push method but I'm having trouble figuring out how to define the model as array object. I thought $scope.shapes = []; should do the job?