Base solution for your next web application
Open Closed

ng2-validation package with version 5.0.4 #4299


User avatar
0
cangunaydin created

Hello, I am trying to migrate my aspnetzero 4.0 angular project to new 5.0 angular project. I was using a npm package as an extra for the version 4.0 but when i try to install the package to new version it is giving me bunch of errors probably it is because of dependencies or sth that i can not find out, here is the package i am trying to install

<a class="postlink" href="https://www.npmjs.com/package/ng2-validation">https://www.npmjs.com/package/ng2-validation</a>

Is there any possibility to install this package to the new version (5.0.4), if it is not possible how can i do the validation except writing a helper component for that? Can you suggest some ideas? maybe there is also a validation in primeng inputs that i am not aware of?

Thanks for your help.


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @cangunaydin,

    It seems like this library is not updated to angular 5 yet. I don't know any other validation library and it seems like prime-ng does not contain validation helpers as well.

    So, you can try to fork this library and update it to angular v5.

  • User Avatar
    0
    cangunaydin created

    Hello @ismcagdas, I followed your advise and try to update it to angular5. But it didn't work. Can it be sth else? Or did i do sth wrong? while i am updating to angular5, i have changed the below packages inside the validation project

    @angular/common@'^5.0.0' @angular/compiler@'^5.0.0' @angular/compiler-cli@'^5.0.0' @angular/core@'^5.0.0' @angular/forms@'^5.0.0' @angular/http@'^5.0.0' @angular/platform-browser@'^5.0.0' @angular/platform-browser-dynamic@'^5.0.0' [email protected] rxjs@'^5.5.2'

    I have also published the newly build package to npm just to test, i am sharing the link

    <a class="postlink" href="https://www.npmjs.com/package/ng5-validation">https://www.npmjs.com/package/ng5-validation</a>

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @cangunaydin,

    I tried below steps and it worked for a single scenario

    • downloaded a new project from aspnetzero.com (v5.0.4)
    • runned "yarn add ng5-validation"
    • Runned Host & angular projects
    • added below line to both app & admin modules.
    import { CustomFormsModule } from 'ng5-validation'
    
    • also added CustomFormsModule to imports array of app & admin modules.
    • added [rangeLength]="[5, 9]" attribute to DisplayName input in create-or-edit-role-modal.component.html

    Do you have an error on javascript console or while starting your angular application ?

  • User Avatar
    0
    cangunaydin created

    Hello, I tried to add the package with npm install ng5-validation --save that's why i guess it doesn't work. Now i understood i should add the package using yarn :) Thank you for the help though.

  • User Avatar
    0
    ismcagdas created
    Support Team

    You are welcome and thanks for your contribution. I didn't know this library before and since it's working with ng5, we can use it :).