Created
November 9, 2014 23:54
-
-
Save 34r7h/7162fa8d3e1220e35246 to your computer and use it in GitHub Desktop.
problems with getting firebase data
This file contains 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
'use strict'; | |
angular.module('nuMetalApp', [ | |
'ngCookies', | |
'ngResource', | |
'ngSanitize', | |
'ui.router', | |
'ui.bootstrap', | |
'firebase' | |
]) | |
.config(function ($stateProvider, $urlRouterProvider, $locationProvider) { | |
$urlRouterProvider | |
.otherwise('/'); | |
$locationProvider.html5Mode(true); | |
}); |
This file contains 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
$icon-font-path: "/bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/"; | |
$fa-font-path: "/bower_components/font-awesome/fonts"; | |
@import 'bootstrap-sass-official/vendor/assets/stylesheets/bootstrap'; | |
@import 'font-awesome/scss/font-awesome'; | |
/** | |
* App-wide Styles | |
*/ | |
.browsehappy { | |
margin: 0.2em 0; | |
background: #ccc; | |
color: #000; | |
padding: 0.2em 0; | |
} | |
// Component styles are injected through grunt | |
// injector | |
@import 'landing/landing.scss'; | |
@import 'main/main.scss'; | |
@import 'modal/modal.scss'; | |
// endinjector |
This file contains 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
'use strict'; | |
angular.module('nuMetalApp') | |
.controller('LandingCtrl', function ($scope, $location, $firebase, $window) { | |
var location = $location.host(); | |
location.toLowerCase().replace(/'+/g, '').replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "-").replace(/^-+|-+$/g, ''); | |
var refString = "https://metal.firebaseio.com/index/domains/"+ location.toString() +"/"; | |
setTimeout(function(){ | |
var indexRef = new Firebase(refString); | |
var mediaRef = new Firebase('https://metal.firebaseio.com/media'); | |
var mediaSync = $firebase(mediaRef); | |
var indexSync = $firebase(indexRef); | |
var indexArray = indexSync.$asArray(); | |
var indexObject = indexSync.$asObject(); | |
var indexValue = indexObject.$value; | |
setTimeout(function(){ | |
var domainRef = 'https://metal.firebaseio.com/domains/'+ indexValue; | |
var ref = new Firebase(domainRef); | |
var sync = $firebase(ref); | |
$scope.height = $window.innerHeight; | |
$scope.location = $location.host(); | |
setTimeout(function(){ | |
$scope.data = sync.$asObject(); | |
$scope.list = sync.$asArray(); | |
$scope.media = mediaSync.$asArray(); | |
console.log('indexObject',indexObject); | |
console.log('domainRef',domainRef); | |
console.log('ref',ref); | |
console.log('sync',sync); | |
console.log('refString',refString); | |
console.log('indexRef',indexRef); | |
console.log('data',$scope.data); | |
console.log('list',$scope.list); | |
console.log('media',$scope.media); | |
}, 1000); | |
},500); | |
},250); | |
}); |
This file contains 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
'use strict'; | |
describe('Controller: LandingCtrl', function () { | |
// load the controller's module | |
beforeEach(module('nuMetalApp')); | |
var LandingCtrl, scope; | |
// Initialize the controller and a mock scope | |
beforeEach(inject(function ($controller, $rootScope) { | |
scope = $rootScope.$new(); | |
LandingCtrl = $controller('LandingCtrl', { | |
$scope: scope | |
}); | |
})); | |
it('should ...', function () { | |
expect(1).toEqual(1); | |
}); | |
}); |
This file contains 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
<div | |
ng-init="landingID = (location||0)" | |
class="text-center" | |
style="display: table; height: {{height}}px ; width:100%;background-position:center;background-repeat: no-repeat;background-image: url('{{media.$getRecord(data.image[0]).mediaURL}}');background-size: 100% 100%" | |
> | |
<div class="clearfix" | |
style=" width:100%;display:table-cell; color:#f5f5f5; font-size: 200%; height:100%;vertical-align:middle; "> | |
<b style="font-size: 200%">Welcome to {{data.url}}</b> | |
<p style="color:white">{{data.text}}</p> | |
<div class="col-xs-12 text-center"> | |
<button class="btn btn-default">Forging Technology</button> | |
</div> | |
</div> | |
</div> |
This file contains 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
'use strict'; | |
angular.module('nuMetalApp') | |
.config(function ($stateProvider) { | |
$stateProvider | |
.state('landing', { | |
url: '/', | |
templateUrl: 'app/landing/landing.html', | |
controller: 'LandingCtrl' | |
}); | |
}); |
This file contains 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
'use strict'; | |
angular.module('nuMetalApp') | |
.controller('MainCtrl', function ($scope, $http) { | |
$scope.awesomeThings = []; | |
$http.get('/api/things').success(function(awesomeThings) { | |
$scope.awesomeThings = awesomeThings; | |
}); | |
}); |
This file contains 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
'use strict'; | |
describe('Controller: MainCtrl', function () { | |
// load the controller's module | |
beforeEach(module('nuMetalApp')); | |
var MainCtrl, | |
scope, | |
$httpBackend; | |
// Initialize the controller and a mock scope | |
beforeEach(inject(function (_$httpBackend_, $controller, $rootScope) { | |
$httpBackend = _$httpBackend_; | |
$httpBackend.expectGET('/api/things') | |
.respond(['HTML5 Boilerplate', 'AngularJS', 'Karma', 'Express']); | |
scope = $rootScope.$new(); | |
MainCtrl = $controller('MainCtrl', { | |
$scope: scope | |
}); | |
})); | |
it('should attach a list of things to the scope', function () { | |
$httpBackend.flush(); | |
expect(scope.awesomeThings.length).toBe(4); | |
}); | |
}); |
This file contains 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
<div ng-include="'components/navbar/navbar.html'"></div> | |
<header class="hero-unit" id="banner"> | |
<div class="container"> | |
<h1>'Allo, 'Allo!</h1> | |
<p class="lead">Kick-start your next web app with Angular Fullstack</p> | |
<img src="assets/images/yeoman.png" alt="I'm Yeoman"> | |
</div> | |
</header> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-lg-12"> | |
<h1 class="page-header">Features:</h1> | |
<ul class="nav nav-tabs nav-stacked col-md-4 col-lg-4 col-sm-6" ng-repeat="thing in awesomeThings"> | |
<li><a href="#" tooltip="{{thing.info}}">{{thing.name}}</a></li> | |
</ul> | |
</div> | |
</div> | |
</div> | |
<footer class="footer"> | |
<div class="container"> | |
<p>Angular Fullstack v2.0.13 | | |
<a href="https://twitter.com/tyhenkel">@tyhenkel</a> | | |
<a href="https://github.com/DaftMonk/generator-angular-fullstack/issues?state=open">Issues</a></p> | |
</div> | |
</footer> |
This file contains 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
'use strict'; | |
angular.module('nuMetalApp') | |
.config(function ($stateProvider) { | |
$stateProvider | |
.state('main', { | |
url: '/', | |
templateUrl: 'app/main/main.html', | |
controller: 'MainCtrl' | |
}); | |
}); |
This file contains 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
.thing-form { | |
margin: 20px 0; | |
} | |
#banner { | |
border-bottom: none; | |
margin-top: -20px; | |
} | |
#banner h1 { | |
font-size: 60px; | |
line-height: 1; | |
letter-spacing: -1px; | |
} | |
.hero-unit { | |
position: relative; | |
padding: 30px 15px; | |
color: #F5F5F5; | |
text-align: center; | |
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); | |
background: #4393B9; | |
} | |
.footer { | |
text-align: center; | |
padding: 30px 0; | |
margin-top: 70px; | |
border-top: 1px solid #E5E5E5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment