引导模块与NG2选模块集成到angular2 5分钟快速入门 [英] integrate bootstrap module and ng2-select module to angular2 5min quickstart

查看:403
本文介绍了引导模块与NG2选模块集成到angular2 5分钟快速入门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何集成引导模块和 NG2选模块angular2 5分钟快速入门,因为我一直有这个错误


  

意外令牌≤(...)



添加片刻:


  

错误:意外令牌≤(...)Zone.run @ angular2-polyfills.js:1243zoneBoundFn @ angular2-polyfills.js:1220lib $ ES6 $承诺$$内部$$ tryCatch @ angular2-polyfills.js:468lib $ ES6 $承诺$$内部$$ invokeCallback @ angular2-polyfills.js:480lib $ ES6 $承诺$$内部$$发布@ angular2-polyfills.js:451lib $ ES6 $承诺$$内部$$ publishRejection @ angular2-polyfills。 JS:401(匿名函数)@ angular2-polyfills.js:123Zone.run @ angular2-polyfills.js:1243zoneBoundFn @ angular2-polyfills.js:1220lib $ ES6 $承诺尽快$ $$平齐@ angular2-polyfills.js:262



 <脚本>
  System.config({
    transpiler:打字稿,
    typescriptOptions:{emitDecoratorMetadata:真正},    包:{
      / angular2:{defaultExtension:虚假},      ./app:{
        格式为:注册,
        defaultExtension:'JS'
      },
      node_modules / AG-网格NG2:{},
      node_modules / AG-网格:{},
      node_modules / NG2选:{},
      NG2自举:{defaultExtension:TS}
    },
    图:{
            AG-网NG2':'node_modules / AG-网格NG2,
            AG-网格:node_modules / AG-网格,
            NG2选':'node_modules / NG2选',
            NG2自举:node_modules / NG2自举,
    }
  });
  System.import(应用程序/主)
        。然后(NULL,console.error.bind(控制台));
< / SCRIPT>

这是我在控制台中

 错误:意外的令牌LT;
评估的http://本地主机:3000 /力矩
错误加载的http://本地主机:3000 /应用/ main.js
在addToError(HTTP://本地主机:3000 / node_modules / systemjs /距离/ system.src.js:41:18)
在linkSetFailed(HTTP://本地主机:3000 / node_modules / systemjs /距离/ system.src.js:628:15)
在http://本地主机:3000 / node_modules / systemjs /距离/ system.src.js:563:9
在doDynamicExecute(HTTP://本地主机:3000 / node_modules / systemjs /距离/ system.src.js:711:7)
在的连结(http://本地主机:3000 / node_modules / systemjs /距离/ system.src.js:910:20)
在doLink(HTTP://本地主机:3000 / node_modules / systemjs /距离/ system.src.js:562:7)
在updateLinkSetOnLoad(HTTP://本地主机:3000 / node_modules / systemjs /距离/ system.src.js:610:18)
在http://本地主机:3000 / node_modules / systemjs /距离/ system.src.js:422:11
在Zone.run(HTTP://本地主机:3000 / node_modules / angular2 /包/ angular2-polyfills.js:1243:24)
在zoneBoundFn(HTTP://本地主机:3000 / node_modules / angular2 /包/ angular2-polyfills.js:1220:26)


解决方案

要使用NG2-自举,只需从NPM安装模块:

  $ NPM安装NG2-NG2引导选

然后,您可以在HTML项文件进行配置:

 <脚本>
  System.configure({
    图:{
      NG2自举:node_modules / NG2自举,
      NG2选':'node_modules / NG2选
    },
    包:{
      (......)
    }
  });
  System.import(...);
< / SCRIPT>

您有因为一个模块不能导入的问题。在你的错误,你应该看到SystemJS试图加载的东西...

修改

按照你的答案,看来,你需要配置一下:

 <脚本>
  System.configure({
    图:{
      (......)
      那一刻:node_modules /力矩/时刻
    },
    (......)
  });
< / SCRIPT>

有关详细信息,请参阅此问题:

这是我在控制台发现后,我加入时刻


  

错误:意外令牌≤(...)Zone.run @ angular2-polyfills.js:1243zoneBoundFn @ angular2-polyfills.js:1220lib $ ES6 $承诺$$内部$$ tryCatch @ angular2-polyfills.js:468lib $ ES6 $承诺$$内部$$ invokeCallback @ angular2-polyfills.js:480lib $ ES6 $承诺$$内部$$发布@ angular2-polyfills.js:451lib $ ES6 $承诺$$内部$$ publishRejection @ angular2-polyfills。 JS:401(匿名函数)@ angular2-polyfills.js:123Zone.run @ angular2-polyfills.js:1243zoneBoundFn @ angular2-polyfills.js:1220lib $ ES6 $承诺尽快$ $$平齐@ angular2-polyfills.js:262


当我写systemjs配置的第一个问题已经解决了,但我没有从我的应用程序文件夹中复制一些文件node_modules \\ systemjs \\ DIST这一切都与扩展名的文件* .js.map我不明白为什么它犯规本身,在我的命令窗口中它告诉我,404 GET *****。​​js.map加载它????你有一个想法?

How can I integrate bootstrap module and ng2-select module to angular2 5min quickstart because I always have this error:

Unexpected token <(…)


after adding moment :

Error: Unexpected token <(…)Zone.run @ angular2-polyfills.js:1243zoneBoundFn @ angular2-polyfills.js:1220lib$es6$promise$$internal$$tryCatch @ angular2-polyfills.js:468lib$es6$promise$$internal$$invokeCallback @ angular2-polyfills.js:480lib$es6$promise$$internal$$publish @ angular2-polyfills.js:451lib$es6$promise$$internal$$publishRejection @ angular2-polyfills.js:401(anonymous function) @ angular2-polyfills.js:123Zone.run @ angular2-polyfills.js:1243zoneBoundFn @ angular2-polyfills.js:1220lib$es6$promise$asap$$flush @ angular2-polyfills.js:262


<script>
  System.config({
    transpiler: 'typescript', 
    typescriptOptions: { emitDecoratorMetadata: true }, 

    packages: {   
      "/angular2": {"defaultExtension": false},

      './app': {
        format: 'register',
        defaultExtension: 'js'
      },
      'node_modules/ag-grid-ng2': {},
      'node_modules/ag-grid': {},
      'node_modules/ng2-select': {},
      'ng2-bootstrap': {"defaultExtension": "ts"}
    },
    map: {
            'ag-grid-ng2': 'node_modules/ag-grid-ng2',
            'ag-grid': 'node_modules/ag-grid',
            'ng2-select': 'node_modules/ng2-select',
            'ng2-bootstrap': 'node_modules/ng2-bootstrap',
    }
  });
  System.import('app/main')
        .then(null, console.error.bind(console));
</script>

and this is what i found in console

Error: Unexpected token <
Evaluating http://localhost:3000/moment
Error loading http://localhost:3000/app/main.js
at addToError (http://localhost:3000/node_modules/systemjs/dist/system.src.js:41:18)
at linkSetFailed (http://localhost:3000/node_modules/systemjs/dist/system.src.js:628:15)
at http://localhost:3000/node_modules/systemjs/dist/system.src.js:563:9
at doDynamicExecute (http://localhost:3000/node_modules/systemjs/dist/system.src.js:711:7)
at link (http://localhost:3000/node_modules/systemjs/dist/system.src.js:910:20)
at doLink (http://localhost:3000/node_modules/systemjs/dist/system.src.js:562:7)
at updateLinkSetOnLoad (http://localhost:3000/node_modules/systemjs/dist/system.src.js:610:18)
at http://localhost:3000/node_modules/systemjs/dist/system.src.js:422:11
at Zone.run (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1243:24)
at zoneBoundFn (http://localhost:3000/node_modules/angular2/bundles/angular2-polyfills.js:1220:26)

解决方案

To use ng2-boostrap, simply install the modules from NPM:

$ npm install ng2-bootstrap ng2-select

You can then configure them in your HTML entry file:

<script>
  System.configure({
    map: {
      'ng2-bootstrap': 'node_modules/ng2-bootstrap',
      'ng2-select': 'node_modules/ng2-select'
    },
    packages: {
      (...)
    }
  });
  System.import(...);
</script>

You have the problem since a module can't be imported. Around your error, you should see what SystemJS tries to load something...

Edit

Following your answer, it appears that you need to configure moment:

<script>
  System.configure({
    map: {
      (...)
      'moment': 'node_modules/moment/moment'
    },
    (...)
  });
</script>

See this question for more details:

this what i found in console after i add moment

Error: Unexpected token <(…)Zone.run @ angular2-polyfills.js:1243zoneBoundFn @ angular2-polyfills.js:1220lib$es6$promise$$internal$$tryCatch @ angular2-polyfills.js:468lib$es6$promise$$internal$$invokeCallback @ angular2-polyfills.js:480lib$es6$promise$$internal$$publish @ angular2-polyfills.js:451lib$es6$promise$$internal$$publishRejection @ angular2-polyfills.js:401(anonymous function) @ angular2-polyfills.js:123Zone.run @ angular2-polyfills.js:1243zoneBoundFn @ angular2-polyfills.js:1220lib$es6$promise$asap$$flush @ angular2-polyfills.js:262

the first problem has been solved when i write systemjs config but i did copied some files from my app folder to node_modules\systemjs\dist it's all the files with extension "*.js.map" i don't understand why it doesnt load it by itself and in my command window it tells me that 404 GET *****.js.map ???? have you an idea?

这篇关于引导模块与NG2选模块集成到angular2 5分钟快速入门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆