4

I have generated a angular 2 application with the angular 2 CLI.

In the index.html file is stuff like:

{{#each scripts.polyfills}}
    <script src="Application/{{.}}"></script>
{{/each}}

When the application is build with the CLI command 'ng build' the output of index.html is:

<script src="Application/vendor/scripts1.js"></script>
<script src="Application/vendor/scripts2.js"></script>
<script src="Application/vendor/scripts3.js"></script>

Now I ask you where is that #each comming from means what language/library?

and

where is the scripts.polyfills object defined in my CLI created angular 2 app.

I can not find any folder/variable with name 'scripts' anywhere.

Pascal
  • 12,265
  • 25
  • 103
  • 195

1 Answers1

4

The polyfills are inbuilt into the angular-cli tool. Polyfill for angular

In the linked page search for options.polyfills. If you want to include other polyfills, the option would be to include it in angular-cli-build.js. For example , to include jquery as a polyfill add the polyfills tags besides vendorNPM files :-

 vendorNpmFiles: [
  'systemjs/dist/system-polyfills.js',
  'systemjs/dist/system.src.js',
  'zone.js/dist/**/*.+(js|js.map)',
  'es6-shim/es6-shim.js',
  'reflect-metadata/**/*.+(ts|js|js.map)',
  'rxjs/**/*.+(js|js.map)',
  '@angular/**/*.+(js|js.map)',
  'jquery/**/*.js'
],
polyfills:[
   'vendor/jquery/dist/jquery.min.js', 
   'vendor/es6-shim/es6-shim.js',
    'vendor/reflect-metadata/Reflect.js',
    'vendor/systemjs/dist/system.src.js',
    'vendor/zone.js/dist/zone.js', 
]
Krishnanunni Jeevan
  • 1,719
  • 1
  • 15
  • 24
  • i've just tried to import angular2-toaster. it is throwing 404 error. It is strange that trying to get index.js which should be angular2-toaster.js. http://localhost:4200/vendor/angular2-toaster/index.js – Tun Aug 25 '16 at 11:18