ng2-validation icon indicating copy to clipboard operation
ng2-validation copied to clipboard

Not working in angular2 application

Open tigredonorte opened this issue 7 years ago • 3 comments

My app doesn't works. The follow error occurs when i include ng2-validation:

(SystemJS) Unexpected token < SyntaxError: Unexpected token < at eval () at e.invoke (http://localhost/node_modules/zone.js/dist/zone.min.js:1:19239) at n.run (http://localhost/node_modules/zone.js/dist/zone.min.js:1:14963) at http://localhost/node_modules/zone.js/dist/zone.min.js:1:12026 Evaluating http://localhost/node_modules/libphonenumber-js/bundles/libphonenumber-js.min Error loading http://localhost/app/main.js

My system.js is:

System.config({
        paths: {
            'npm:': './node_modules/'
        },
        map: {
               'ng2-validation' : 'npm:ng2-validation/bundles/ng2-validation.umd.js'
        },
        packages: {
               'ng2-validation' : {main: 'index' , defaultExtension: 'js'}
        }
});

i tryed this variations too:

System.config({
        paths: {
            'npm:': './node_modules/'
        },
        map: {
               'ng2-validation' : 'npm:ng2-validation/bundles/ng2-validation.umd.js'
        }
});
System.config({
        paths: {
            'npm:': './node_modules/'
        },
        map: {
               'ng2-validation'           : 'npm:ng2-validation/dist/index.js',
              'ng2-validation/dist/*'  : 'npm:ng2-validation/dist/*'
        },
        packages: {
               'ng2-validation'            : {main: 'index'      , defaultExtension: 'js'},
                'ng2-validation/dist/'      : {main: 'index'  , defaultExtension: 'js'}
        }
});

Has something wrong in my code or its a bug?

tigredonorte avatar May 03 '17 23:05 tigredonorte

i fix this adding libphonenumber in my project. But i think this is some kind of bug.. because i don't want add it in project. my final system config is:

System.config({
        paths: {
            'npm:': './node_modules/'
        },
        map: {
            'ng2-validation'          : 'npm:ng2-validation/bundles/ng2-validation.umd.js',
            'libphonenumber-js'   : 'npm:libphonenumber-js/bundle/libphonenumber-js.min.js'
        },
        packages: {
              'ng2-validation'            : {defaultExtension: 'js'},
             'libphonenumber-js'         : {defaultExtension: 'js'}
        }
});

tigredonorte avatar May 03 '17 23:05 tigredonorte

I cant figure this out either. I'm stuck on 3.9.1 because updating gives this same error. I did an npm install for libphonenumber-js but am still getting the error if i dont add it in my project like @tigredonorte . Not sure what the issue is here.

dhniels avatar May 30 '17 18:05 dhniels

@tigredonorte update: FWIW, i just tried removing it from "packages" in the system config and only added it under "map" and it seems to work...

dhniels avatar May 30 '17 18:05 dhniels