Comments (32)
I fixed this by change the import path of the module:
import {NouisliderModule} from 'ng2-nouislider'
=> import {NouisliderModule} from 'ng2-nouislider/src/nouislider'
from ng2-nouislider.
@karan83 I did the same think you said
"styles": [ "styles.css", "../node_modules/nouislider/distribute/nouislider.min.css" ],
in my angular-cli.json.
I added the following html
<nouislider [connect]="true" [min]="0" [max]="15" [(ngModel)]="someRange"></nouislider>
when I run I get
EXCEPTION: Error in ./AppComponent class AppComponent - inline template:4:50 caused by: noUiSlider (9.2.0): 'start' is required.
error_handler.js:56Error: noUiSlider (9.2.0): 'start' is required.
at http://localhost:4200/vendor.bundle.js:82478:12 [angular]
at Array.forEach (native) [angular]
at testOptions (http://localhost:4200/vendor.bundle.js:82472:22) [angular]
at Object.initialize [as create] (http://localhost:4200/vendor.bundle.js:83751:17) [angular]
at NouisliderComponent.ngOnInit (http://localhost:4200/vendor.bundle.js:81432:34) [angular]
at Wrapper_NouisliderComponent.ngDoCheck (/AppModule/NouisliderComponent/wrapper.ngfactory.js:180:53) [angular]
at CompiledTemplate.proxyViewClass.View_AppComponent0.detectChangesInternal (/AppModule/AppComponent/component.ngfactory.js:73:33) [angular]
at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:4200/vendor.bundle.js:74489:14) [angular]
at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:4200/vendor.bundle.js:74684:44) [angular]
at CompiledTemplate.proxyViewClass.AppView.internalDetectChanges (http://localhost:4200/vendor.bundle.js:74474:18) [angular]
at CompiledTemplate.proxyViewClass.View_AppComponent_Host0.detectChangesInternal (/AppModule/AppComponent/host.ngfactory.js:29:19) [angular]
at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:4200/vendor.bundle.js:74489:14) [angular]
at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:4200/vendor.bundle.js:74684:44) [angular]
at ViewRef_.detectChanges (http://localhost:4200/vendor.bundle.js:55251:20) [angular]
from ng2-nouislider.
Put NouisliderComponent in declarations not imports.
from ng2-nouislider.
@visar1897 Thank You :)
from ng2-nouislider.
I am getting this too. Did you find a solution @jredd?
from ng2-nouislider.
I was able to resolve this by importing NouisliderComponent and adding that to the app's declarations. Did not do anything with NouisliderModule.
from ng2-nouislider.
`import { AppComponent } from './app.component';
import { NouisliderComponent } from 'ng2-nouislider';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
NouisliderComponent
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }`
And I still get ERROR in NouisliderComponent is not an NgModule
am I doing something wrong?
from ng2-nouislider.
@hisham thanks you so much for the quick reply and help, that worked for me.
from ng2-nouislider.
@hisham do you have a basic angular-cli project that I can take a look at to see how you have used this please ?
from ng2-nouislider.
Not publicly no, but it was pretty east to use and setup.
from ng2-nouislider.
I added @import "../node_modules/nouislider/distribute/nouislider.min.css";
to my css file, and I changed it to component like you suggested, but when I run, this is a new angular-cli (latest on CLI) project with nothing else in it, and I get
zone.js:405Unhandled Promise rejection: Failed to load ../node_modules/nouislider/distribute/nouislider.min.css ; Zone: <root> ; Task: Promise.then ; Value: Failed to load ../node_modules/nouislider/distribute/nouislider.min.css undefined consoleError @ zone.js:405 _loop_1 @ zone.js:434 drainMicroTaskQueue @ zone.js:438 ZoneTask.invoke @ zone.js:349 2017-01-10 13:04:34.585 zone.js:407Error: Uncaught (in promise): Failed to load ../node_modules/nouislider/distribute/nouislider.min.css at resolvePromise (zone.js:486) [<root>] at resolvePromise (zone.js:471) [<root>] at :4200/vendor.bundle.js:88804:17 [<root>] at Zone.runTask (zone.js:151) [<root> => <root>] at drainMicroTaskQueue (zone.js:418) [<root>] at XMLHttpRequest.ZoneTask.invoke (zone.js:349) [<root>]
from ng2-nouislider.
Looks like a path issue. Try to add that css file under "styles" in your angular-cli.json instead of through @import. This is what I got:
"styles": [ "../node_modules/bootstrap/dist/css/bootstrap.min.css", "../node_modules/nouislider/distribute/nouislider.min.css"]
from ng2-nouislider.
so bootstrap is needed as dependency? I missed that. I will try it. Thanks again for your help
from ng2-nouislider.
Doesn't look like it. I was just using bootstrap in my project for other things.
from ng2-nouislider.
I don't think you have too? If you want it styled and all that, I think it's needed, but you could just look at all the classes and create your own... I ended up overriding a decent number of mine anyways. @Hishman sorry for the slow response, I wasn't able to overcome the issue and thanks for sharing your solution. Haven't tried it yet.
from ng2-nouislider.
Yeah no bootstrap needed. You can see the app i did using nouislider in angular 2 here btw: http://cora-patient.snapdx.co/. Those sliders are nouisliders with our own css styles applied.
We should probably close this ticket as @jredd's question has now been answered.
from ng2-nouislider.
@hisham agreed on closing!
from ng2-nouislider.
I know you closed this issue, but I am still struggling with getting it to work. I created a repo https://github.com/daBishMan/slider it is public with both of you as contributors.
Can you help?
from ng2-nouislider.
Sure. What specific issue are you running into now?
from ng2-nouislider.
I can not get the UI to show, and it does not run, there is something wrong in my setup. I am not sure what it is.
from ng2-nouislider.
Usually in this case there is an error in the browser console you can see.
from ng2-nouislider.
@daBishMan, I had same issue & i have fixed UI issue by adding css file in angular-cli.json.
"styles": [ "styles.css", "../node_modules/nouislider/distribute/nouislider.min.css" ]
I have cloned your repository and it's working fine by adding css file.
from ng2-nouislider.
@karan83 I made you a contributor on my repo, can you check in what you have working please with sugar on top please.
from ng2-nouislider.
I was able to finally sit down and do the changes @hisham suggested and it worked just fine for me. @daBishMan I can't look at it right now but if the issue hasn't been resolved this evening I'll try and take a peek at it.
from ng2-nouislider.
I began having this issue. When I move NouisliderModule to declarations instead of imports I see Unexpected module 'NouisliderModule' declared by the module 'MyModule'
but I think this may be an angular-cli issue I'm seeing related to angular/angular-cli#3426
from ng2-nouislider.
@ryan-morris you no longer have to use NouisliderModule
but rather have NouisliderComponent
in your declarations.
from ng2-nouislider.
@daBishMan Did you resolve the problem? I am also getting the same issue.
from ng2-nouislider.
@hemanrnjn sorry I was not able to to fix it.
from ng2-nouislider.
Any update on the same. Have imported NouisliderComponent in app.module.ts and in the app.component.ts. Added css file in ,angular-cli.json. Am not getting any error, but slider component is not showing up. Please let me know what am I missing, am using @angular/cli 1.0.0.
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { NouisliderComponent } from 'ng2-nouislider';
@NgModule({
declarations: [
AppComponent,
NouisliderComponent ],
imports: [
BrowserModule,
FormsModule,
HttpModule,
ReactiveFormsModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
app.component.ts
import { Component, Input, OnInit, AfterViewInit } from '@angular/core';
import { Validators, FormGroup, FormBuilder, FormArray, FormControl } from '@angular/forms';
import { NouisliderComponent } from 'ng2-nouislider';
@component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
title = 'app works!';
form1: FormGroup;
form2: FormGroup;
constructor(protected fb: FormBuilder) {
//console.log("QuestionBaseFormComponent Constructor:", this.children);
}
ngOnInit() {
this.form1 = this.fb.group({ 'single': [ 10 ] });
console.log(this.form1);
this.form2 = this.fb.group({ 'range': [ [ 2, 8 ] ] });
}
}
app.component.html
<nouislider [connect]="true" [min]="0" [max]="15" [(ngModel)]="someRange">
.angular-cli.json
"styles": [
"styles.css",
"../node_modules/nouislider/distribute/nouislider.min.css"
],
from ng2-nouislider.
Got it working, thanks. Stopped the server and restarted. Have another query as how do I shown the slider value as it moves? Thanks.
from ng2-nouislider.
Declaring the component instead of importing the module seems like a workaround not a fix.
from ng2-nouislider.
I think this is version issue, this work fine for me please go through once if you still getting the error
npm i --save nouislider [email protected]
from ng2-nouislider.
Related Issues (20)
- suddenly started having error TS2305: Module '"../../node_modules/ng2-nouislider/ng2-nouislider"' has no exported member 'NouisliderModule'. HOT 4
- How to find which handle is being dragged in custom event? HOT 2
- Return all parameters in event HOT 2
- Materialize design
- Component does not work with formControlName attribute HOT 3
- Error when setting start with the value of a variable. HOT 1
- Angular 9 support HOT 1
- Angular Build WARNING - depends on 'nouislider'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies HOT 4
- Slider snaps on manually setting a value between steps HOT 3
- TypeError: Cannot read property 'from' of undefined at NouisliderComponent.toValues HOT 1
- Potentially not compatible with Ivy warning HOT 1
- ng2-nouislider vertical, direction rtl issue HOT 1
- Add handles dynamically in reactive form
- Keyboard support handle issue when multi connect option is used. HOT 1
- The website is blocked in India HOT 1
- Angualr 12/13/14 new lib format HOT 1
- is this lib dead ? HOT 2
- Angular 14 [(ngModel])
- NouisliderModule does not have a module def (ɵmod property) for Angular16 HOT 1
- Disabled attribute doesnt work as expected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng2-nouislider.