0

I have used AngularJS for web design in a standalone, small memory, small storage embedded device with no internet connection. I included local copies of the javascript files for angularjs, bootstrap, and jquery, and it all worked fine.

I would like to switch to Angular 2 (and eventually 4). It isn't clear to me how to identify the required standalone Angular files needed for an offline web application such as mine.

Where can I find the Angular 2 files to ship with my offline application?

4
  • npmjs.com/search?q=angular Commented Jun 14, 2017 at 18:09
  • If you had looked at the angular.io website that is listed at the top of the tutorial and intro pages. Commented Jun 14, 2017 at 18:10
  • See Angular Developer Guide - QuickStart Commented Jun 14, 2017 at 20:18
  • I've read and run the QuickStart, but it doesn't completely answer my question. When running ng serve --open, the my-app folder doesn't contain any of the compiled javascript. The index.html file points to several javascript files, such as inline.bundle.js, polyfills.bundle.js, and styles.bundle.js. I presume those are the files that need to be shipped, but where are they? Commented Jun 14, 2017 at 20:42

1 Answer 1

2

If you are asking how you ship the files with your app, angular-cli uses webpack to bundle everything for you in your dist directory when you run 'ng build --prod', aggregation, minification, and tree-shaking is done for you. You would have to re-write your package.json file to use the older version of angular.

If you want to use it locally from a device you will also need to re-write the in index.html so the loader can find your bundles etc.

<script>document.write('<base href="' + document.location + '" />');</script>

https://unpkg.com/#/ is the NPM repository for all angular modules you can download them individually if you like with whatever version you are after, I am not sure why you would want to do this though since dependencies, order, aggregation, tree-shaking, minification etc. would then be your responsibility

Also if you can avoid 2.0 and use 4.0 that's the best bet and would require the least work as far as reconfiguration using the ng-cli etc.

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

1 Comment

Thank you @Todd.Werelius. The "dist" folder is created by --prod, and that contains a cohesive set of files including the javascript and index.html files. As you said, I had to replace the canned base reference in index.html with the dynamic document.location.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.