Created
December 1, 2014 19:31
-
-
Save awhedbee22/a8de21ac8f76a1224883 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('vegas.controllers', []) | |
// Data for this seed is stored in the "awvegas" firebase. | |
// To view the raw data, open https://awvegas.firebaseio.com/.json in a browser | |
// A simple controller that fetches a list of data from a service | |
.controller('ScheduleIndexCtrl', function($scope, $firebase) { | |
// "Items" is a service returning mock data (services.js) | |
var ref = new Firebase('https://awvegas.firebaseio.com/items'); | |
$scope.items = $firebase(ref); | |
}) | |
// A simple controller that shows a tapped item's data | |
.controller('ScheduleDetailCtrl', function($scope, $stateParams, $firebase) { | |
// "Item" is a service returning mock data (services.js) | |
var ref = new Firebase('https://awvegas.firebaseio.com/items/' + $stateParams.itemId); | |
$scope.items = $firebase(ref); | |
}) | |
// A simple controller which adds a new Item | |
.controller('AddCtrl', function($scope, $stateParams, $firebase, $log, $location) { | |
var ref = new Firebase('https://awvegas.firebaseio.com/items/'); | |
$scope.items = $firebase(ref); | |
$scope.createItem = function (item) { | |
var ref = $scope.items.$add(item); | |
$scope.item = {}; | |
$log.info("Your data has been saved to https://awvegas.firebaseio.com/items/" + ref.name() + ".json"); | |
alert(" Your item has been saved!"); | |
$location.path("/"); | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<view title="'Schedule'"> | |
<content has-header="true" has-tabs="true"> | |
<list> | |
<item ng-repeat="item in items" type="item-text-wrap" href="#/tab/schedule/{{items.id}}"> | |
<h3>{{items.title}}</h3> | |
<p>{{items.description}}</p> | |
</item> | |
</item> | |
</list> | |
</content> | |
</view> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment