subarroca / ng-gauge

Gauge generic component made with angular2 and SVG
https://subarroca.github.io/ng-gauge/
13 stars 6 forks source link

Usage error #1

Closed nowrap closed 7 years ago

nowrap commented 7 years ago

Hello, i am trying to use the module in my ionic 2 app.

I've installed it according the docs: npm install ng2-kw-gauge -S

In the app.module.ts i added: import { GaugeModule, GaugeSegment, GaugeLabel } from 'ng2-kw-gauge'; @NgModule({ imports: [ IonicModule.forRoot(MyApp), GaugeModule, GaugeSegment, GaugeLabel ],

The template.html looks like: <ng2-kw-gauge></ng2-kw-gauge>

But i get a browser error: Error: Cannot find module "ng2-kw-gauge"

Maybe someone can point me in the correct direction what i'am doing wrong?

subarroca commented 7 years ago

You should not declare GaugeLabel nor GaugeSegment in your module, only where you're gonna use it.

Also if you are using system.js you should map it there too.

That's the only thing I see wrong right now.

nowrap commented 7 years ago

Thx for your answer. A system.js i don't have.

I redirected the question to the ionic forum. Maybe it's an ionic specific "mapping" thing.

subarroca commented 7 years ago

Perfect, just let me know

nowrap commented 7 years ago

Today, it worked ... Only the gauge.component.scss couldn't be loaded. I had to copy it to the www directory. Unhandled Promise rejection: Failed to load gauge.component.scss ; Zone: <root> ; Task: Promise.then ; Value: Failed to load gauge.component.scss undefined

subarroca commented 7 years ago

It's weird. I'll check again in my code if scss is loading

subarroca commented 7 years ago

I can confirm it's working

Tyler-Darby commented 7 years ago

@nowrap @subarroca Can you guys post a full example? I'm having trouble getting it to work too

Tyler-Darby commented 7 years ago

Here's my error that I am getting:

Uncaught Error: Module build failed: TypeError: Cannot read property 'content' of undefined
    at Object.typescriptSourcemapLoaderMemory
subarroca commented 7 years ago

Hi @Tyler-Darby could you specify the version of angular you're using and if it's combined with ionic?

Tyler-Darby commented 7 years ago

@subarroca I got it working, It was excluded in my tsconfig.json for some reason, all good now. Awesome little component you've got here 👍

zjw1918 commented 7 years ago

@Tyler-Darby hi, Having the same problem, "Cannot read property 'content' of undefined", how do you solve that, thanks.

Tyler-Darby commented 7 years ago

@zjw1918 Are you using Ionic?

I made this tweak to my tsconfig.json file.

  "include": [
    "src/**/*.ts",
    "node_modules/ng2-kw-gauge/index.ts"
  ],
subarroca commented 7 years ago

Thanks @Tyler-Darby