Jump to content

An error about import the module :DigilentChart , DeviceService


Recommended Posts

Hello,
When I'm look about the link of 
https://reference.digilentinc.com/reference/software/digilent-instrumentation-protocol/angular2
In step 7 ,when I write 
import { DigilentChart } from 'digilent-chart-angular2/components';

in my project,it show a error

image.png.81bc939b7c0f8169cdfe9ad742c5e933.png

so I replace it to import { DigilentChart } from 'digilent-chart-angular2/modules';  but when I add DigilentChart to declarations it get error image.png.9cfc9636661a2c93711678a5a64316c6.png 

my codes:image.png.58c6062def139a06e5f1ee4b12ee15ee.png

and when I use image.png.f21db7d9de8fbae1a9c1e026dd0d04cf.png

the   errors image.png.2ddfb37e27db28bd15d6fa1d5ff50c26.png

please help me

Link to comment
Share on other sites

Okay I know what the problem is. I'll update the documentation thank you for finding this.

I've updated my ionic version to 3.19.0 (the latest version).

This is what app.module.ts should say:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';

import { HelloIonicPage } from '../pages/hello-ionic/hello-ionic';
import { ItemDetailsPage } from '../pages/item-details/item-details';
import { ListPage } from '../pages/list/list';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { DeviceManagerService } from 'dip-angular2/services';
import { DigilentChartModule } from 'digilent-chart-angular2/modules';

@NgModule({
  declarations: [
    MyApp,
    HelloIonicPage,
    ItemDetailsPage,
    ListPage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    DigilentChartModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HelloIonicPage,
    ItemDetailsPage,
    ListPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    DeviceManagerService
  ]
})
export class AppModule {}

 

Then you can follow the tutorial as normal. Note that DeviceService is just a type and cannot be instantiated and therefore cannot be added to the providers array. Instead we use it in hello-ionic.ts in order to get typing for an instance of the device in the DeviceManagerService.

 

Let me know if you have any more questions,

Dharsan

Link to comment
Share on other sites

On 2017/12/6 at 2:41 AM, sudharsan.sukumar said:

Also, we're planning on coming out with a pure ts / js version of DIP that doesn't require Angular (though we still recommend using Angular/Ionic for large scale applications). If you're interested, I can send you an update here when we publish it within the next few weeks.

-Dharsan

Thanks a lot,I am  interesting the pure ts / js version of DIP that doesn't require Angular,that‘s cool.

it is best to combine a simple example, because I'm afraid I will not use it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...