-
Notifications
You must be signed in to change notification settings - Fork 122
Closed
Description
Hello I have problem with loading data, right after I load them from backend, entity has hasDirtyAttributes:true and on save its sending complete entity back to backend instead of only changed fields. happens for findAll() and find()
ngOnInit() {
this.clients = this.route.snapshot.data['clients'].getModels();
}
client.resolve.ts
export class ClientsResolve implements Resolve<any> {
constructor(private datastore: ClientDatastore) {
}
resolve(route: ActivatedRouteSnapshot): Observable<any> | Promise<any> | any {
let include = '';
if (route.data.include) {
include += route.data.include;
}
return this.datastore.findAll(Client, {
include: include
});
}
}
client.routes.ts
{
path: 'list',
component: ClientListComponent,
data: {
breadcrumb: 'Přehled',
include: 'advisor'
},
resolve: {
clients: ClientsResolve
}
},
client.datastore.ts
const config: DatastoreConfig = {
baseUrl: environment.apiURL + '/v2',
models: {
client: Client,
advisors: Advisor,
goals: Goal
}
};
@Injectable()
@JsonApiDatastoreConfig(config)
export class ClientDatastore extends JsonApiDatastore {
constructor(http: Http) {
super(http);
this.headers = new Headers({'Authorization': 'Bearer ' + localStorage.getItem('token')});
}
}
RicardoNeves
Metadata
Metadata
Assignees
Labels
No labels