Skip to content

Instantly share code, notes, and snippets.

@jawache
Last active May 7, 2018 12:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jawache/a254768fecf107248f3323cddb465d84 to your computer and use it in GitHub Desktop.
Save jawache/a254768fecf107248f3323cddb465d84 to your computer and use it in GitHub Desktop.
AngularJS Migration Course Resources - Step 6
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {UpgradeModule} from '@angular/upgrade/static';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
@NgModule({
imports: [
BrowserModule,
UpgradeModule
]
})
export class AppModule {
// Override Angular bootstrap so it doesn't do anything
ngDoBootstrap() {
}
}
// Bootstrap using the UpgradeModule
platformBrowserDynamic().bootstrapModule(AppModule).then(platformRef => {
console.log("Bootstrapping in Hybrid mode with Angular & AngularJS");
const upgrade = platformRef.injector.get(UpgradeModule) as UpgradeModule;
upgrade.bootstrap(document.body, ['codecraft']);
});
"dependencies": {
"angular": "1.4.0",
"angular-animate": "1.4.0",
"angular-auto-validate": "^1.19.0",
"angular-ladda": "^0.4.3",
"angular-resource": "1.4.0",
"angular-strap": "^2.3.12",
"angularjs-toaster": "^2.1.0",
"bootstrap": "3.3.2",
"bootstrap-additions": "0.3.1",
"font-awesome": "4.3.0",
"jquery": "2.1.3",
"ng-infinite-scroll": "1.2.1",
"angular-ui-router": "^0.4.2",
"angular-spinner": "^1.0.1"
}
// This file includes polyfills needed by Angular and is loaded before
// the app. You can add your own extra polyfills to this file.
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/set';
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: "./src/app/main.ts",
output: {
filename: "src/dist/bundle.js"
},
resolve: {
// Add '.ts' and '.tsx' as a resolvable extension.
extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
},
module: {
loaders: [
// all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'
{ test: /\.tsx?$/, loader: "ts-loader" }
]
},
plugins: [
new webpack.ContextReplacementPlugin(
// if you have anymore problems tweet me at @gdi2290
// The (\\|\/) piece accounts for path separators for Windows and MacOS
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, 'src'), // location of your src
{} // a map of your routes
)
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment