fix insert function

This commit is contained in:
reaw55 2021-12-08 22:59:06 +07:00
parent e4002ce835
commit a7d6ee9cd3
3 changed files with 27 additions and 17 deletions

View File

@ -19,8 +19,8 @@ export class DataProviderService {
// }
public url = 'http://4255-34-91-36-11.ngrok.io/'
insert(dbname: String,colname: String,web: String,cat: String){
//return this.http.get<providerData>("http://localhost:/insert?dbname="+dbname+"&collectionname="+colname+"&web="+web+"&cat="+cat);
return this.http.get<providerData>(this.url+"/insert?dbname=data&collectionname=testdata&web=com.burbn.instagram&cat=photos");
return this.http.get<providerData>(this.url+"/insert?dbname="+dbname+"&collectionname="+colname+"&web="+web+"&cat="+cat);
//return this.http.get<providerData>(this.url+"/insert?dbname=data&collectionname=testdata&web=com.burbn.instagram&cat=test");
}
public filter(cat: String){

View File

@ -7,16 +7,23 @@
<ion-card>
<ion-item>
<ion-label>Web</ion-label>
<br/>
<br>
<ion-input [(ngModel)]="web"></ion-input>
</ion-item>
<ion-item>
<ion-label>Category</ion-label>
<br/>
<br>
<ion-input [(ngModel)]="category"></ion-input>
</ion-item>
<ion-button expand='full' (click)="submit()">
Submit
</ion-button>
</ion-card>
<div *ngIf='data$ | async as ans'>
<ion-card>
<ion-card-content>
{{ans}}
</ion-card-content>
</ion-card>
</div>
</ion-content>

View File

@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { providerData } from 'src/models/temp.model';
import { DataProviderService } from '../data-provider.service';
@Component({
selector: 'app-tab2',
@ -8,7 +10,8 @@ import { DataProviderService } from '../data-provider.service';
export class Tab2Page implements OnInit {
public web: String
public category: String
constructor(private DataProviderService: DataProviderService) {}
public data$: Observable<providerData>
constructor(private tempProvider: DataProviderService) {}
ngOnInit() {
@ -16,7 +19,7 @@ export class Tab2Page implements OnInit {
submit() {
var dbname = "data"
var colname = "testdata"
this.DataProviderService.insert(dbname,colname,this.web,this.category)
this.data$=this.tempProvider.insert(dbname,colname,this.web,this.category)
}