Commit 2c24b863 authored by h3remi7's avatar h3remi7

add apps service

parent 66424af4
......@@ -2,4 +2,6 @@
background-color: darkslategray;
width: 280px;
flex-shrink: 0;
}
\ No newline at end of file
......@@ -4,4 +4,5 @@
</a>
<a href="#" class="list-group-item list-group-item-action">绯想天</a>
<a href="#" class="list-group-item list-group-item-action disabled">永远消失的幻想乡</a>
<a href="#" class="list-group-item list-group-item-action disabled"></a>
</div>
\ No newline at end of file
......@@ -2,9 +2,18 @@
* Created by zh99998 on 16/9/2.
*/
import { Component } from '@angular/core';
import { AppsService } from './apps.service'
@Component({
selector: 'apps',
templateUrl: 'app/apps.component.html',
styleUrls: ['app/apps.component.css'],
})
export class AppsComponent { }
export class AppsComponent {
data = '';
constructor(private appsService: AppsService) {
appsService.getApps();
//this.data = appsService.data;
}
}
import { Injectable } from '@angular/core';
import { Http,Response } from '@angular/http';
//import { Observable } from 'rxjs';
//import 'rxjs/add/operator/map'
import 'rxjs/Rx';
@Injectable()
export class AppsService {
constructor(private http: Http) {}
data = '';
getApps() {
console.log(123);
this.http.get('./apps.json').map((res) => {console.log(res)})//.subscribe(res => this.data = res);
}
}
\ No newline at end of file
......@@ -2,4 +2,6 @@
background-color: #336699;
height: 236px;
flex-shrink: 0;
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ body {
nav {
-webkit-app-region: drag;
padding-right: 0;
flex-shrink: 0;
}
nav.darwin {
......
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { MyCardComponent } from './mycard.component';
import { LoginComponent } from './login.component';
import { StoreComponent } from './store.component';
......@@ -11,12 +13,13 @@ import { CandyComponent } from './candy.component';
import { CommunityComponent } from './community.component';
import { RoutingService } from './routing.service';
import { AppsService } from './apps.service';
@NgModule({
imports: [ BrowserModule ],
imports: [ BrowserModule,HttpModule ],
declarations: [ MyCardComponent, LoginComponent, StoreComponent, LobbyComponent, CommunityComponent, AppsComponent, AppDetailComponent, RosterComponent, CandyComponent ],
bootstrap: [ MyCardComponent ],
providers: [ RoutingService ],
providers: [ RoutingService, AppsService ],
})
export class MyCard { }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment