Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelknoch committed Mar 24, 2016
1 parent 855b59a commit 23f88ef
Show file tree
Hide file tree
Showing 11 changed files with 5,620 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules/
.idea
typings

*.js
*js.map
*js.map
app/components
30 changes: 15 additions & 15 deletions app/LocationComponent/location.component.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import {Component} from 'angular2/core';
import {RouteParams, Router} from 'angular2/router';
import {LocationService} from '../services/location.service'
import {LocationService} from '../services/location.service';

@Component({
template: '<h2>Location</h2>'
templateUrl: './app/locationComponent/template.html'
})
export class LocationComponent implements OnInit {

location:Location;
export class LocationComponent {

constructor(private _router:Router,
private _routeParams:RouteParams,
private _locationService:LocationService) {
locations:Locations;

_locationService.locations
.subscribe(
people => this.people = people,
error => console.error('Error: ' + err),
() => console.log('Completed!')
);
}
constructor(private _router:Router, private _routeParams:RouteParams, private locationService:LocationService) {

ngOnInit() {
let id = this._routeParams.get('id');
console.info(id);
console.info("jojo");

locationService.getLocations().subscribe(
data => {
this.locations = data;
console.info(this.locations);
},
err => console.err(err)
);
}

}
9 changes: 9 additions & 0 deletions app/LocationComponent/template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="grid">
<h2>Locations</h2>
<div *ngFor="#location of locations" class="one-quarter location-thumb">
<div class="back-img"
style="background-image:url('https://locator-app.com{{location.obj.images.normal}}')"></div>
<h3>{{location.obj.title}}</h3>

</div>
</div>
7 changes: 2 additions & 5 deletions app/UserComponent/user.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ import {RouteParams, Router} from 'angular2/router';
template: '<h2>Location</h2>'
})

export class UserComponent implements OnInit {
export class UserComponent {

location:Location;

constructor(private _router:Router,
private _routeParams:RouteParams) {
}

ngOnInit() {
let id = this._routeParams.get('id');
console.info(id);
//this._service.getHero(id).then(hero => this.hero = hero);
}

}
}
5 changes: 3 additions & 2 deletions app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {Component} from 'angular2/core';
import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';

import {LocationComponent} from './LocationComponent/location.component';
import {UserComponent} from './UserComponent/user.component';
import {LocationComponent} from './LocationComponent/location.component';
import {UserComponent} from './UserComponent/user.component';

import {LocationService} from './services/location.service';

@Component({
selector: 'dash',
template: '<router-outlet></router-outlet>',
providers: [LocationService],
directives: [ROUTER_DIRECTIVES]
})

Expand Down
4 changes: 3 additions & 1 deletion app/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {AppComponent} from './app.component';
import {bootstrap} from 'angular2/platform/browser';
import {ROUTER_PROVIDERS} from 'angular2/router';
import {HTTP_PROVIDERS} from 'angular2/http';


bootstrap(AppComponent, [
ROUTER_PROVIDERS
ROUTER_PROVIDERS, HTTP_PROVIDERS
]);
14 changes: 9 additions & 5 deletions app/services/location.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import {Injectable} from 'angular2/angular2';
import {Http} from 'angular2/http';
import {Injectable} from 'angular2/core';
import {Http, HTTP_PROVIDERS} from 'angular2/http';
import 'rxjs/Rx';

@Injectable()
export class LocationService {

constructor(http:Http) {
this.locations = http.get("http://locator.in.htwg-konstanz.de:2020/locations/nearby?long=9.169753789901733&lat=47.66868204997508&maxDistance=100000000000&limit=1000000000")
.map(response => response.json());
this.http = http;
}
}

getLocations() {
return this.http.get('./mock.json')
.map(res => res.json())
}
}
21 changes: 21 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "locator-dash",
"description": "dashboard",
"main": "",
"authors": [
"Michael Knoch <[email protected]>"
],
"license": "ISC",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"app/components",
"test",
"tests"
],
"dependencies": {
"gridism": "^0.2.1"
}
}
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

<title>Angular 2 QuickStart</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="app/components/gridism/gridism.css">
<link rel="stylesheet" href="style/main.css">

<!-- 1. Load libraries -->
Expand All @@ -18,6 +19,8 @@
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>


<!-- 2. Configure SystemJS -->
<script>
Expand Down
Loading

0 comments on commit 23f88ef

Please sign in to comment.