astronaut1712 / angular2-odoo-jsonrpc

OdooRPC for angular2
21 stars 24 forks source link

How use the plugin? #3

Open jdmm opened 8 years ago

jdmm commented 8 years ago

Hello, I can't use the plugin, I get the following error: website.assets_frontend.js:1022 Error: Error: Can't resolve all parameters for RequestOptions: (?).(…)(anonymous function) @ website.assets_frontend.js:1022 . I have the following code: Can't resolve all parameters for RequestOptions: (?).(…)(anonymous function) @ website.assets_frontend.js:1022. I have the following code:

import { Component } from '@angular/core'; import { Hero } from './hero'; import { HeroDetailComponent } from './hero-detail.component'; import { HeroService } from './hero.service'; import { OnInit } from '@angular/core'; import {OdooRPCService } from 'angular2-odoo-jsonrpc' import { Http, ConnectionBackend, RequestOptions } from "@angular/http";

@Component({ selector: 'my-app', template: `

{{title}}

<h2>My Heroessss</h2>
<ul class="heroes">
  <li *ngFor="let hero of heroes" (click)="onSelect(hero)"
  [class.selected]="hero === selectedHero">
  <span class="badge">{{hero.id}}</span> {{hero.name}}
  </li>
</ul>
<my-hero-detail [hero]="selectedHero"></my-hero-detail>
<!--<my-odoo-rpc></my-odoo-rpc>-->

`, providers: [ HeroService, OdooRPCService, Http, ConnectionBackend, RequestOptions ]

}) export class AppComponent implements OnInit { title = 'Tour of Heroes'; heroes : Hero[]; selectedHero: Hero; onSelect(hero: Hero): void { this.selectedHero = hero; }

constructor(private heroService: HeroService, public odooRPC: OdooRPCService ){
    console.log('lmdksndksndkns')
    odooRPC.init({
        odoo_server: "https://localhost:8069",
        http_auth: "admin:123" // optional
    });
    odooRPC.login('condominio', 'admin', '123').then(res => {
        console.log('login success');
    }).catch( err => {
        console.error('login failed', err);
    })
}

getConectionOdoo(): void{
    console.log('mknsdjksndkjnskdn')
   this.odooRPC.call('res_partner',"name_search",[],[]).then(res =>{
       console.log('bjdbjsbjdbsjdbjsdb');
       console.log(res);
   }).catch( err => {
        console.error('login failed', err);
    })

}

getHeroes(): void {
    this.heroService.getHeroes().then(heroes => this.heroes = heroes);
 }

ngOnInit(): void {
    this.getHeroes();
    this.getConectionOdoo();

}

}

drm-code commented 7 years ago

Any updates?

hengkyz commented 7 years ago

@drm-code any issue? please feel free to create new issue, i will help you