Giter Site home page Giter Site logo

angular2 rc.3 about ng2-nouislider HOT 8 CLOSED

tb avatar tb commented on July 17, 2024
angular2 rc.3

from ng2-nouislider.

Comments (8)

TobiasKrogh avatar TobiasKrogh commented on July 17, 2024

EDIT: updated regarding third release candidate (sorry for spam)

from ng2-nouislider.

tb avatar tb commented on July 17, 2024

It should work now with angular2 rc3, see commit 59263fa

from ng2-nouislider.

TobiasKrogh avatar TobiasKrogh commented on July 17, 2024

@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.

tb avatar tb commented on July 17, 2024

@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.

TobiasKrogh avatar TobiasKrogh commented on July 17, 2024

@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.

tb avatar tb commented on July 17, 2024

@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.

TobiasKrogh avatar TobiasKrogh commented on July 17, 2024

@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.

TobiasKrogh avatar TobiasKrogh commented on July 17, 2024

created #3

from ng2-nouislider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.