Comments (8)
EDIT: updated regarding third release candidate (sorry for spam)
from ng2-nouislider.
It should work now with angular2 rc3, see commit 59263fa
from ng2-nouislider.
@tb unfortunately not yet completely. I encountered several small things.
Just updating the package shows the following error which is related to the forms related API changes that happened in Angular 2 RC 2:
ORIGINAL EXCEPTION: Name attribute must be set if ngModel is used within a form.
Example: <input [(ngModel)]="person.firstName" name="first">
This is reported by the template parser. Therefore simply writing name="my-name"
it in the template seems enough. You might want to extend the documentation for that.
When this works I see another error reported by zone.js
EXCEPTION: Error: Uncaught (in promise): No value accessor for 'foobar'
Which I think is related to the fact that you are using the "old" value accessor. They should be imported from "@angular/forms" imho.
import {
ControlValueAccessor,
NG_VALUE_ACCESSOR
} from '@angular/forms';
Can you double check please? Shall I open a new issue for that?
from ng2-nouislider.
@TobiasKrogh Please note I am not using input in any place on demos - nouislider is always on div and has ngModel - see http://tb.github.io/ng2-nouislider/
You can also build the code locally with:
git clone --recursive [email protected]:tb/ng2-nouislider.git
cd ng2-nouislider
npm i
npm start
There are form directives in Material2 repository, thats where I look at as reference for changes, i.e. https://github.com/angular/material2/blob/master/src/components/checkbox/checkbox.ts
from ng2-nouislider.
@tb Please note that the Example: <input [(ngModel)]="person.firstName" name="first">
is just an example being given by the template parser when an exception is logged. It expects a name attribute on an element with ngModel if that element is used inside of a form (which might happen for a slider imho). I think it does not check whether this attribute is really necessary it is just the parser.
My markup:
<form>
<div
#slider
nouislider
[connect]="true"
[min]="0"
[max]="15"
[step]="1"
[(ngModel)]="fields[filter.key]">
</div>
</form>
I will just use the slider apart from all other form controls. Still there remains the issue with the value accessor.
As you can read here: http://angularjs.blogspot.de/2016/06/rc2-now-available.html There were major changes to Forms and as soon as someone uses the disableDeprecatedForms directives have to be imported from @angular/forms instead of @angular/common (API change proposal: https://docs.google.com/document/u/1/d/1RIezQqE4aEhBRmArIAS1mRIZtWFf6JxN_7B4meyWK0Y/pub)
I have no idea when material2 will follow up but they also seem not to be fully migrated yet (checking their https://github.com/angular/material2/blob/master/CHANGELOG.md).
I found an up 2 date example here: https://github.com/primefaces/primeng/blob/master/components/checkbox/checkbox.ts
I also tried to clone the ng2-nouislider repo but ended up with an empty demo folder so I cannot try it myself. Else I would have set up a pull request. Still can do if you give me a hint about how to manage to get the demo running properly. The latests commit in the demo folder also looks related to rc.1
from ng2-nouislider.
@TobiasKrogh Ah, to get demo you need git clone --recursive [email protected]:tb/ng2-nouislider.git
.
I wont be able to look at it till evening.
from ng2-nouislider.
@tb thanks... will try to look into it
EDIT: got it to work... git@ only works per ssh so I had to manually change the command and the registered submodule url to the http variants
I will set up a pull request with the required changes
from ng2-nouislider.
created #3
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.