Commit 93fe025d authored by Janik Münzenberger's avatar Janik Münzenberger
Browse files

Get plant with offline cache

parent 3454f63d
......@@ -49,6 +49,7 @@ import {LanguageSwitchComponent} from './components/language-switch/language-swi
import {NotificationService} from "./services/notification.service";
import { UserDataService } from './services/user-data.service';
import { TimeoutDirective } from './directives/timeout.directive';
import { PlantService } from './services/plant.service';
export function HttpLoaderFactory(http: HttpClient) {
......@@ -110,7 +111,8 @@ export function HttpLoaderFactory(http: HttpClient) {
],
providers: [AnalysisService, ApiService, AuthService,
AuthguardService, UserService, GardenerService,
MapService, NotificationService, UserDataService],
MapService, NotificationService, UserDataService,
PlantService],
bootstrap: [AppComponent]
})
export class AppModule {
......
......@@ -7,8 +7,7 @@ import { Subscription } from 'rxjs';
@Component({
selector: 'app-plantdetails',
templateUrl: './plantdetails.component.html',
styleUrls: ['./plantdetails.component.css'],
providers: [PlantService]
styleUrls: ['./plantdetails.component.css']
})
export class PlantdetailsComponent implements OnInit, OnDestroy {
plant: IPlant;
......
......@@ -5,8 +5,7 @@ import { PlantService } from '../../services/plant.service';
@Component({
selector: 'app-plants',
templateUrl: './plants.component.html',
styleUrls: ['./plants.component.css'],
providers: [ PlantService ]
styleUrls: ['./plants.component.css']
})
export class PlantsComponent implements OnInit {
......
......@@ -21,7 +21,7 @@ export class PlantService extends DataService{
let plant = await this.readSingleItem<IPlant>(id);
return plant;
}catch(err){
let plant = this.plants.find(plant => plant._id === id);
let plant = this.plants.find(plant => plant._id == id);
if(!plant) throw err;
else return plant;
}
......
Supports Markdown
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