С помощью RestAPI я пытаюсь удалить одну запись из моей базы данных с помощью этого простого кода.
import { Component } from '@angular/core';
import { RestangularModule, Restangular } from 'ngx-restangular';
import { HomePage } from '../pages/home/home';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = HomePage;
constructor(private restangular: Restangular) {
this.restangular.one('v1/my_products', '5b3621ce1dbaba5598cdbe08')
.get()
.subscribe((res: any) => {
res.data.remove();
})
}
}
Странно, документ был успешно удален, но я всегда получаю следующую ошибку, и мое приложение не работает
> ERROR TypeError: Cannot create property 'route' on number '1'
at restangularizeBase (ngx-restangular.js:54)
at restangularizeElem (ngx-restangular.js:184)
at SafeSubscriber.okCallback [as _next] (ngx-restangular.js:360)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:238)
at SafeSubscriber.next (Subscriber.js:185)
at Subscriber._next (Subscriber.js:125)
at Subscriber.next (Subscriber.js:89)
at CatchSubscriber.Subscriber._next (Subscriber.js:125)
at CatchSubscriber.Subscriber.next (Subscriber.js:89)
at MapSubscriber._next (map.js:83)
Package.json
{
"dependencies": {
"@angular/animations": "5.0.1",
"@angular/common": "5.0.1",
"@angular/compiler": "5.0.1",
"@angular/compiler-cli": "5.0.1",
"@angular/core": "5.0.1",
"@angular/forms": "5.0.1",
"@angular/http": "5.0.1",
"@angular/platform-browser": "5.0.1",
"@angular/platform-browser-dynamic": "5.0.1",
"@ionic-native/core": "4.8.0",
"@ionic-native/splash-screen": "4.8.0",
"@ionic-native/status-bar": "4.8.0",
"@ionic/storage": "2.1.3",
"core-js": "^2.5.7",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"ngx-restangular": "2.0.1",
"rxjs": "5.4.3",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.10",
"typescript": "~2.6.2"
}
}
Тот же случай с ngx-restangular@1.0.13 - 3.0.0
что не так?