Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tether-related error in Angular 2 app made with angular-cli #19923

Closed
alvipeo opened this issue May 17, 2016 · 6 comments
Closed

Tether-related error in Angular 2 app made with angular-cli #19923

alvipeo opened this issue May 17, 2016 · 6 comments
Labels

Comments

@alvipeo
Copy link

alvipeo commented May 17, 2016

Angular cli projects use system.js and if you try to use Bootstrap 4 (which requires tether) you're in trouble.

  1. you can't use 'import "tether"' - this just doesn't work. Bootstrap throws
  2. I tried to use it with "script" tag - this makes ng2 app work but tests fail

So it's either your app work or your tests.

Related - shipshapecode/tether#177.

@alvipeo
Copy link
Author

alvipeo commented May 17, 2016

Related issues - angular/angular-cli#630
and this one - angular/angular-cli#699

@cvrebert
Copy link
Collaborator

Bootstrap throws

Please copy-paste the error message you're getting.

(2) I tried to use it with

Use it with what?

@cvrebert cvrebert changed the title No way of using Bootstrap 4 in angular 2 app made with angular cli - tether Tether-related error in Angular 2 app made with angular-cli May 17, 2016
@alvipeo
Copy link
Author

alvipeo commented May 17, 2016

Updated original post.

Tests fail with some weird error but guys from angular team told me that script are not loaded in correct order. I tried to change karma.config and include jquery, tether and bootstrap into it but that doesn't change anything.

@alvipeo
Copy link
Author

alvipeo commented May 17, 2016

If I comment out script tag then I get this:

Unhandled Promise rejection: Error: Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)
        at eval (http://localhost:4200/vendor/bootstrap/dist/js/bootstrap.min.js:7:2417)
        at eval (http://localhost:4200/vendor/bootstrap/dist/js/bootstrap.min.js:7:10496)
        at eval (http://localhost:4200/vendor/bootstrap/dist/js/bootstrap.min.js:7:12639)
        at Object.eval (http://localhost:4200/app/test-app-cli.component.js:17:1)
    Evaluating http://localhost:4200/vendor/bootstrap/dist/js/bootstrap.min.js
    Evaluating http://localhost:4200/app/test-app-cli.component.js
    Evaluating http://localhost:4200/app/index.js
    Evaluating http://localhost:4200/main.js
    Error loading http://localhost:4200/main.js ; Zone: <root> ; Task: Promise.then ; Value: Error: Error: Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)(…)

@cvrebert
Copy link
Collaborator

Approximate duplicate of #19017. See #17325 for context. Our ES6 modules story is still a work-in-progress at the moment.

@oh-wo
Copy link

oh-wo commented Nov 4, 2017

A hack to get both tests and the app working is to do the following:

  1. In index.html before you load your angular app (e.g. head tags):
<script>var Tether = {};</script>
  1. In your app.module.ts:
// Bootstrap requires tether.
import Tether from 'tether';
import 'bootstrap';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants