1

I am including ng2-bs3-modal for creating modals in angular2 , according to this thread . Since the ng2-bs3-modal and the js files that it loads (like modal.js, modal-header.js) does not take .js as their extension by default , i had to use deafultJsExtension: true to achieve that . To prevent angular errors according to that same thread(angular is loading its modules again in the browser), i included system.config directly after loading systemjs , instead of writing it after loading angularjs,

 <script src="node_modules/es6-shim/es6-shim.min.js">
    </script>
    <script src="node_modules/systemjs/dist/system-polyfills.js">
    </script>
    <script src="node_modules/systemjs/dist/system.src.js">
    </script>
    <!-- 2. Configure SystemJS -->
    <script>
        System.config({
          defaultJSExtensions: true,
          packages: {
            angular: { defaultExtension: false },
            app: {
              format: 'register',
              defaultExtension: 'js'
            },
          },
          map: {
              'ng2-bs3-modal': 'node_modules/ng2-bs3-modal',
          }
        });
        System.import('node_modules/jquery/dist/jquery.min.js')
        System.import('node_modules/bootstrap/dist/js/bootstrap.min.js');
        System.import('app/js/main')
        .then(null, console.error.bind(console));
    </script>
    <script src="node_modules/angular2/bundles/angular2-polyfills.js">
    </script>
    <script src="node_modules/rxjs/bundles/Rx.js">
    </script>
    <script src="node_modules/angular2/bundles/angular2.dev.js">
    </script>

Now, sometimes it works fine, sometimes it says that browser.js, core.js not found, also system.js error

(in console it says GET http://localhost:3000/angular2/core.js 404 (Not Found) -- system.src.js:1068 Assertion failed: loading or loaded -- system.src.js:291

can someone identify this Thanks

1 Answer 1

0

Ok, so the answer was quite obvious from the error , i had to write a map for angular2 as well ::-

map: {
       'ng2-bs3-modal': 'node_modules/ng2-bs3-modal',
       'angular2': 'node_modules/angular2'
     }

Maybe this had to do with the sequence of files and polyfill scripts loading, but this sequence was taken from sources i read on the internet and nowhere it was written that we may encounter such error.

It is happening with everyone right ? Or is it just me

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.