Angular2 bundle.js:2 Uncaught ReferenceError: google is not defined - google-maps

I use the 2.0.0-rc.4 version of Angular. I have always "google is not defined" problem in my console
console error
bundle.js:2 Uncaught ReferenceError: google is not defined
With Angular Beta without gulp, I have not had the problem.
typings folder content
my ** gulpfile.js** file
var gulp = require('gulp');
gulp.task('bundle', function() {
var SystemBuilder = require('systemjs-builder');
var builder = new SystemBuilder();
builder.loadConfig('./system.config.js')
.then(function(){
var outputFile = 'dist/bundle.js';
return builder.buildStatic('app', outputFile, {
minify: true,
mangle: true,
rollup: true
});
})
.then(function(){
console.log('bundle built successfully!');
});
});
package.json
{
"name": "angular2-poc",
"scripts": {
"clean": "gulp clean",
"compile": "gulp compile",
"build": "gulp build",
"postinstall": "typings install",
"test": "tsc && karma start",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
"typings": "typings"
},
"devDependencies": {
"concurrently": "^1.0.0",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-jshint": "^2.0.1",
"gulp-minify": "0.0.11",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.1",
"gulp-uglify": "^1.5.3",
"gulp-util": "^3.0.7",
"jasmine-core": "~2.3.4",
"jshint": "^2.9.2",
"karma": "~0.13.15",
"karma-jasmine": "~0.3.6",
"karma-phantomjs2-launcher": "^0.3.2",
"lite-server": "2.0.1",
"path": "^0.12.7",
"systemjs-builder": "^0.15.16",
"traceur": "^0.0.91",
"typescript": "^1.7.3",
"yargs": "^4.7.0"
},
"dependencies": {
"#angular/common": "2.0.0-rc.4",
"#angular/compiler": "2.0.0-rc.4",
"#angular/core": "2.0.0-rc.4",
"#angular/http": "2.0.0-rc.4",
"#angular/platform-browser": "2.0.0-rc.4",
"#angular/platform-browser-dynamic": "2.0.0-rc.4",
"#angular/router": "3.0.0-beta.1",
"#angular/upgrade": "2.0.0-rc.4",
"#angular/forms": "0.2.0",
"es6-shim": "^0.35.0",
"events": "^1.0.2",
"fbjs": "^0.3.1",
"flux": "^2.1.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.27",
"zone.js": "^0.6.12"
}
}
My tsd.json file
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"googlemaps/google.maps.d.ts": {
"commit": "de82425735f84a10b43921ae4b1d085b3752a626"
}
}
}
Thanks you

Try loading these 2 files from your index.html
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
For more details, refer this - https://developers.google.com/chart/interactive/docs/basic_load_libs
See if this helps.

Related

Fullcalendar in angular problem with print of multiple events

I have an angular 14 application with fullcalendar. If I have a lot of events in my calendar and I try to print it, the print looks like this :
First page:
Second page:
Here are the events on my calendar:
Does anyone know what might be the problem ?
Here is my package.json
{
"name": "pilotage",
"version": "1.10.0",
"scripts": {
"start": "npm run init-version && ng serve",
"start-local": "npm run init-version && ng serve",
"init-version": "node -e \"console.log('export const APP_VERSION = \\'' + process.env.npm_package_version +'\\';')\" > ./src/app/version.ts",
"build": "node --max_old_space_size=4092 \"node_modules/#angular/cli/bin/ng\" build --configuration production --configuration=production",
"bundle-all": "node bundle-all.js",
"lint": "ng lint",
"e2e": "ng e2e",
"test": "ng test --browsers Chrome",
"coverage": "ng test --code-coverage=true --browsers Chrome",
"set-node": "nvm use 12.4.0",
"msvs": "npm config set msvs_version 2017",
"memory": "node --max_old_space_size=8192",
"postinstall": "ngcc"
},
"private": true,
"dependencies": {
"#angular/animations": "14.2.12",
"#angular/cdk": "14.2.1",
"#angular/common": "14.2.12",
"#angular/compiler": "14.2.12",
"#angular/core": "14.2.12",
"#angular/elements": "14.2.12",
"#angular/flex-layout": "^14.0.0-beta.41",
"#angular/forms": "14.2.12",
"#angular/localize": "14.2.12",
"#angular/platform-browser": "14.2.12",
"#angular/platform-browser-dynamic": "14.2.12",
"#angular/router": "14.2.12",
"#angular/service-worker": "14.2.12",
"#auth0/angular-jwt": "5.0.2",
"#formio/angular": "^5.3.0",
"#fullcalendar/adaptive": "6.0.1",
"#fullcalendar/angular": "6.0.1",
"#fullcalendar/core": "6.0.1",
"#fullcalendar/daygrid": "6.0.1",
"#fullcalendar/interaction": "6.0.0",
"#fullcalendar/moment": "6.0.0",
"#fullcalendar/moment-timezone": "6.0.0",
"#fullcalendar/resource": "^6.0.0",
"#fullcalendar/resource-timeline": "6.0.0",
"#fullcalendar/rrule": "6.0.0",
"#fullcalendar/timegrid": "6.0.0",
"#ng-bootstrap/ng-bootstrap": "^14.0.0",
"#popperjs/core": "^2.11.2",
"#ng-select/ng-select": "^9.0.0",
"#ngx-translate/core": "12.1.1",
"#ngx-translate/http-loader": "4.0.0",
"#swimlane/ngx-datatable": "^20.1.0",
"#types/quill": "^1.3.10",
"admin-lte": "2.3.8",
"angular-pipes": "^10.0.0",
"angular2-logger": "^0.7.0",
"bootstrap": "3.4.1",
"bootstrap-datepicker": "1.9.0",
"bootstrap3-wysihtml5-bower": "0.3.3",
"chart.js": "4.0.1",
"class-validator": "0.11.0",
"daterangepicker": "3.0.5",
"exceljs": "4.1.1",
"fastclick": "1.0.6",
"file-saver": "2.0.2",
"formio-export-mc": "0.3.32",
"formiojs": "4.12.7",
"html2canvas": "1.0.0-rc.5",
"html2pdf.js": "^0.9.2",
"i": "0.3.7",
"jQuery.print": "1.5.1",
"jquery": "3.6.2",
"jquery-knob": "1.2.11",
"jquery-slimscroll": "1.3.8",
"jquery-sparkline": "2.4.0",
"lodash": "4.17.21",
"lodash-es": "^4.17.21",
"moment": "2.29.4",
"moment-timezone": "0.5.27",
"ng-drag-drop": "^5.0.0",
"ng2-date-picker": "^15.0.1",
"ng2-file-upload": "1.4.0",
"ng2-pdf-viewer": "^6.4.0",
"ng2-timezone-selector": "0.2.4",
"ngx-accordion": "^0.0.17",
"ngx-bootstrap": "10.0.0",
"ngx-datatable": "^1.0.3",
"ngx-filesize": "2.0.2",
"ngx-image-cropper": "3.0.3",
"ngx-infinite-scroll": "8.0.1",
"ngx-pagination": "5.0.0",
"ngx-print": "^1.2.1",
"ngx-quill": "17.0.0",
"ngx-select-dropdown": "3.2.0",
"ngx-time-duration-picker": "^2.0.3",
"ngx-toastr": "13.2.1",
"ngx-tooltip": "^0.0.9",
"ngx-ui-switch": "^14.0.3",
"ngx-webstorage-service": "4.1.0",
"quill": "1.3.7",
"quill-image-resize-module": "3.0.0",
"rrule": "2.6.4",
"rxjs": "6.5.4",
"select2": "4.0.13",
"timepicker": "1.13.0",
"xlsx": "^0.16.0",
"yiq": "3.0.1",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "~14.2.10",
"#angular-devkit/core": "^14.2.10",
"#angular-devkit/schematics": "^14.2.10",
"#angular/cli": "^14.2.10",
"#angular/compiler-cli": "14.2.12",
"#angular/language-service": "14.2.12",
"#types/core-js": "2.5.2",
"#types/events": "^3.0.0",
"#types/file-saver": "2.0.1",
"#types/jasmine": "~3.6.0",
"#types/jasminewd2": "2.0.6",
"#types/jquery": "3.3.32",
"#types/moment": "2.13.0",
"#types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"prettier": "^2.4.1",
"protractor": "~7.0.0",
"sass-material-colors": "0.0.5",
"ts-node": "8.6.2",
"tslib": "^2.4.1",
"tslint": "~6.1.0",
"typescript": "4.6.4"
}
}
Also this is the configuration for my full calendar that I use :
this.options = {
editable: !this.isBusy,
events: this.eventsModel,
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridThreeDays,timeGridDay',
},
height: this.maxHeight,
droppable: true,
dayMaxEventRows: 3,
dayMaxEvents: 4,
firstDay: this.firstDay,
snapDuration: {
minutes: 15,
},
selectable: true,
timeZone: this.timeZone,
dateClick: this._dateClick,
datesSet: this._datesRender,
drop: this._drop,
eventClick: this._eventClick,
eventDidMount: this._eventDidMount,
eventDragStart: this._eventDragStart,
eventDragStop: this._eventDragStop,
eventDrop: this._eventDrop,
eventResize: this._eventResize,
eventResizeStart: this._eventResizeStart,
select: this._select,
schedulerLicenseKey: this.schedulerLicenseKey,
initialView: 'timeGridWeek',
nowIndicator: true,
locales: [frLocale],
locale: utils.getCurrentLang(),
views: {
timeGridThreeDays: {
type: 'timeGrid',
duration: { days: 3 },
buttonText: this.translateService.instant(constants.AGENDA_CUSTOMVIEWS_TIMEGRIDTHREEDAYS),
},
},
eventTimeFormat: {
hour: 'numeric',
minute: '2-digit',
},
plugins: [
dayGridPlugin,
timeGridPlugin,
interactionPlugin,
momentPlugin,
momentTimezonePlugin,
rrulePlugin,
adaptivePlugin,
],
};

Can't resolve 'primeng/components/utils/ObjectUtils'

I migrated my project from angular 4 to angular 6 it is running well on localhost but at AOT-build time it gets an error like:
ERROR in ./aot/app/home/accountant/customercost-form.component.ngfactory.ts
Module not found: Error: Can't resolve 'primeng/components/utils/ObjectUtils' in '/home/com5/Paresh/New Angular 6/AOT-6/aot/app/home/accountant'
# ./aot/app/home/accountant/customercost-form.component.ngfactory.ts 16:10-57
# ./aot/app/home/accountant/accounts.module.ngfactory.ts
# ./app/home/index.ts
# ./app/home/auth-guard.service.ts
# ./aot/app/app.module.ngfactory.ts
# ./app/main-aot.ts
ERROR in ./aot/app/home/accountant/vendorcost-form.component.ngfactory.ts
Module not found: Error: Can't resolve 'primeng/components/utils/ObjectUtils' in '/home/com5/Paresh/New Angular 6/AOT-6/aot/app/home/accountant'
# ./aot/app/home/accountant/vendorcost-form.component.ngfactory.ts 16:10-57
# ./aot/app/home/accountant/accounts.module.ngfactory.ts
# ./app/home/index.ts
# ./app/home/auth-guard.service.ts
# ./aot/app/app.module.ngfactory.ts
# ./app/main-aot.ts
ERROR in [at-loader] ./aot/app/app.module.ngfactory.ts:67:40
TS2339: Property 'ɵm' does not exist on type 'typeof import("/home/com5/Paresh/New Angular 6/AOT-6/node_modules/#angular/core/core")'.
my tsconfig-aot.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015","es2017", "dom"],
"noImplicitAny": true,
"removeComments": true,
"skipLibCheck": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/#types/"
],
"outDir": "aot",
"baseUrl": ".",
"paths": {
"#angular/*": ["node_modules/#angular/*"]
}
},
"files": [
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
}
Package.json
{
"name": "My-app",
"version": "0.5.0",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"build:aot": "node --max_old_space_size=6144 node_modules/.bin/ngc -p tsconfig-aot.json && node --max_old_space_size=6144 node_modules/.bin/rollup -c rollup-config.js",
"lite:aot": "lite-server -c aot/bs-config.json",
"e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"pree2e": "webdriver-manager update",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w",
"ngc": " node --max_old_space_size=6144 node_modules/.bin/ngc -p tsconfig-aot.json",
"webpack-prod": " npm run ngc && npm run webpack",
"webpack": "node --max_old_space_size=6144 node_modules/.bin/webpack ",
"serve": "webpack-dev-server",
"prodserver": "node prodserver"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/angular/angular.io/blob/master/LICENSE"
}
],
"dependencies": {
"#angular/animations": "^6.1.10",
"#angular/common": "^6.1.10",
"#angular/compiler": "^6.1.10",
"#angular/compiler-cli": "^6.1.10",
"#angular/core": "^6.1.10",
"#angular/forms": "^6.1.10",
"#angular/http": "^6.1.10",
"#angular/platform-browser": "^6.1.10",
"#angular/platform-browser-dynamic": "^6.1.10",
"#angular/platform-server": "^6.1.10",
"#angular/router": "^6.1.10",
"#angular/upgrade": "^6.1.10",
"#auth0/angular-jwt": "^5.0.1",
"#ngtools/webpack": "^1.1.2",
"#types/googlemaps": "^3.2.0",
"#types/jquery": "^2.0.48",
"#types/jspdf": "^1.3.0",
"#types/node": "8.0.0",
"angular-in-memory-web-api": "^0.11.0",
"angular2-busy": "^1.0.2",
"angular2-datatable": "^0.5.3",
"angular2-datatable-pagination": "0.0.3",
"angular2-highcharts": "^0.5.5",
"angular2-image-upload": "^0.3.1",
"angular2-jwt": "^0.1.28",
"angular2-moment": "^1.0.0-beta.rc.1",
"angular2-multiselect-dropdown": "^2.9.0",
"angular2-router-loader": "^0.3.5",
"angular2-tag-input": "^1.2.3",
"bootstrap": "^3.3.7",
"bootstrap-datepicker": "^1.6.4",
"bootstrap-daterangepicker": "^2.1.25",
"bootstrap-timepicker": "^0.5.2",
"chart.js": "^2.8.0",
"core-js": "2.5.6",
"css-toggle-switch": "^4.0.2",
"express": "^4.15.3",
"fullcalendar": "^3.0.1-beta",
"highcharts": "7.1.1",
"install": "^0.10.1",
"lodash": "^4.17.11",
"moment": "2.18.1",
"mydatepicker": "^1.0.18",
"ng2-bootstrap": "^1.1.16",
"ng2-ckeditor": "1.2.0",
"ng2-datetime": "^1.4.0",
"ng2-device-detector": "^0.1.0",
"ng2-file-upload": "^1.2.0",
"ng2-imageupload": "^1.3.0",
"ng2-select2": "^1.0.0-beta.11",
"ng2-table": "^1.3.2",
"ngx-barcode": "^0.2.4",
"primeng": "^6.1.7",
"primeui": "^4.1.15",
"quill": "^1.3.0",
"reflect-metadata": "^0.1.9",
"rxjs": "6.3.2",
"rxjs-compat": "^6.6.3",
"rxjs-tslint": "^0.1.8",
"screenfull": "4.0.1",
"style-loader": "^0.17.0",
"systemjs": "0.19.40",
"tinymce": "^4.5.5",
"to-string-loader": "^1.1.5",
"tslib": "^2.0.1",
"typings": "^2.1.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular/cli": "6.2.9",
"#types/file-saver": "0.0.1",
"#types/googlemaps": "^3.26.20",
"#types/jquery": "^2.0.48",
"#types/node": "7.0.7",
"angular-router-loader": "^0.6.0",
"angular2-template-loader": "0.6.2",
"angular2-toaster": "^6.1.0",
"awesome-typescript-loader": "3.1.3",
"canonical-path": "0.0.2",
"clean-webpack-plugin": "^0.1.16",
"compression-webpack-plugin": "^0.4.0",
"concurrently": "^3.0.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.1",
"electron-packager": "^8.7.0",
"extract-text-webpack-plugin": "^2.1.0",
"favicons-webpack-plugin": "0.0.7",
"file-loader": "^0.11.1",
"html-loader": "^0.4.3",
"html-webpack-plugin": "2.28.0",
"http-server": "^0.10.0",
"karma": "^5.2.2",
"lite-server": "^2.2.2",
"raw-loader": "^0.5.1",
"rollup": "^0.41.6",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1",
"source-map-explorer": "^1.3.3",
"typescript": "2.9.2",
"webdriver-manager": "12.0.6",
"webpack": "^2.5.1",
"webpack-bundle-analyzer": "^2.8.1",
"webpack-dev-server": "2.4.5"
}
}
main-aot.ts
import { platformBrowser } from '#angular/platform-browser';
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
import { enableProdMode } from '#angular/core';
enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
this is all my configuration files
Not sure if you're having the same problem I had, but when I upgraded from Angular 8 to 9 (and from PrimeNG 8 to 9), I needed to change the import path for ObjectUtils from "primeng/components/utils/ObjectUtils" to just "primeng/utils".

Angular6 rxjs 6 update

Hi I appreciate these are a pain.
After updating Angular to version 6 and rxjs to version 6 we are getting a lot of browser errors that the system is unable to instantiate a number of packages.
We use a combination of node_modules and systemjs.config.server.js
without trying to start an argument on whether one is better than the other, If there are any improvements please let me know.
package.json
{
"version": "1.0.0",
"name": "infrastructure-annual-reporting",
"private": true,
"dependencies": {
"#angular/animations": "^6.0.0",
"#angular/cdk": "^6.0.0",
"#angular/common": "^6.0.0",
"#angular/compiler": "^6.0.0",
"#angular/core": "^6.0.0",
"#angular/forms": "^6.0.0",
"#angular/http": "^6.0.0",
"#angular/material": "^6.0.1",
"#angular/platform-browser": "^6.0.0",
"#angular/platform-browser-dynamic": "^6.0.0",
"#angular/router": "^6.0.0",
"angular-date-value-accessor": "^0.0.2",
"bootstrap": "^3.3.7",
"core-js": "^2.5.6",
"hammerjs": "^2.0.8",
"ng2-bs3-modal": "^0.13.0",
"ngx-accordion": "^0.0.17",
"nodemailer": "^4.6.4",
"rxjs": "^6.1.0",
"rxjs-compat": "^6.1.0",
"rxjs-tslint": "^0.1.3",
"socks": "^2.2.0",
"systemjs": "^0.21.3",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular/cli": "^6.0.0",
"#angular/language-service": "^6.0.0",
"#types/hammerjs": "^2.0.35",
"#types/jasmine": "^2.8.7",
"#types/node": "^10.0.6",
"codelyzer": "^4.3.0",
"jasmine": "^3.1.0",
"karma": "^2.0.2",
"lite-server": "^2.3.0",
"lodash": "^4.17.10",
"protractor": "^5.3.1",
"ts-node": "^6.0.3",
"tslint": "^5.10.0",
"typescript": "^2.8.3"
},
"keywords": [],
"license": "MIT",
"peerDependencies": {
"#angular/core": ">=2.0.0",
"#angular/common": ">=2.0.0",
"#angular/compiler": ">=2.0.0",
"#angular/platform-browser": ">=2.0.0",
"#angular/platform-browser-dynamic": ">=2.0.0",
"#angular/cdk": "6.0.1"
},
"repository": {},
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
}
}
systemjs.config.server.js
(function (global) {
// map tells the System loader where to look for things
var paths = {
'npm:': "https://unpkg.com/"
};
var map = {
'app': "app", // 'dist',
'#angular': "node_modules/#angular",
'angular2-in-memory-web-api': "node_modules/angular2-in-memory-web-api",
'rxjs': "npm:rxjs",
'#angular/platform-browser/animations': "npm:#angular/platform-browser/bundles/platform-browser-animations.umd.min.js",
"ngx-accordion": "npm:ngx-accordion#0.0.17/index.js",
'#angular/common/http': "npm:#angular/common/bundles/common-http.umd.js",
'#angular/animations/browser': "npm:#angular/animations#5.2.10/bundles/animations-browser.umd.js",
'ng2-bs3-modal': "npm:ng2-bs3-modal/bundles/ng2-bs3-modal.umd.js",
'hammerjs':"npm:hammerjs/hammer.js",
// CDK individual packages
'#angular/cdk/bidi': "npm:#angular/cdk/bundles/cdk-bidi.umd.js",
'#angular/cdk/platform': "npm:#angular/cdk/bundles/cdk-platform.umd.js",
'#angular/cdk/keycodes': "npm:#angular/cdk/bundles/cdk-keycodes.umd.js",
'#angular/cdk/collections': "npm:#angular/cdk/bundles/cdk-collections.umd.js",
'#angular/cdk/portal': "npm:#angular/cdk/bundles/cdk-portal.umd.js",
'#angular/cdk/coercion': "npm:#angular/cdk/bundles/cdk-coercion.umd.js",
'#angular/cdk/overlay': "npm:#angular/cdk/bundles/cdk-overlay.umd.js",
'#angular/cdk/accordion': "npm:#angular/cdk/bundles/cdk-accordion.umd.js",
'#angular/cdk/observers': "npm:#angular/cdk/bundles/cdk-observers.umd.js",
'#angular/cdk/layout': "npm:#angular/cdk/bundles/cdk-layout.umd.js",
'#angular/cdk/scrolling': "npm:#angular/cdk/bundles/cdk-scrolling.umd.js",
'#angular/cdk/table': "npm:#angular/cdk/bundles/cdk-table.umd.js",
'#angular/cdk/stepper': "npm:#angular/cdk/bundles/cdk-stepper.umd.js",
'#angular/cdk/a11y': "npm:#angular/cdk/bundles/cdk-a11y.umd.js",
'#angular/cdk/tree' : "node_modules/#angular/cdk#6.0.1/tree",
'tslib': "npm:tslib/tslib.js",
'rxjs/operators' : "npm:rxjs/operators/"
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: "main.js", defaultExtension: "js" },
'rxjs': { defaultExtension: "js" },
'rxjs-compact': { defaultExtension: "js" },
'angular2-in-memory-web-api': { main: "index.js", defaultExtension: "js" }
};
var ngPackageNames = [
"animations",
"common",
"compiler",
"core",
"forms",
"http",
"material",
"platform-browser",
"platform-browser-dynamic",
"router"
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages["#angular/" + pkgName] = { main: "index.js", defaultExtension: "js" };
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages["#angular/" + pkgName] = { main: "bundles/" + pkgName + ".umd.js", defaultExtension: "js" };
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
paths: paths,
map: map,
packages: packages
};
System.config(config);
})(this);
the errors that we are seeing in the browser are
in cmd : npm install rxjs-compat#6 --save
in systemjs.config :
packages: {
app: {
defaultExtension: 'js',
meta: {
'./*.js': {
loader: 'systemjs-angular-loader.js'
}
}
},
main_angular_upgrade:{
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js', main: "index.js"
},
"rxjs-compat": { defaultExtension: 'js', main: "index.js" },
"rxjs/operators": { "main": "index.js", "defaultExtension": "js" },
"rxjs/internal-compatibility": { "main": "index.js", "defaultExtension": "js" },
"rxjs/testing": { "main": "index.js", "defaultExtension": "js" },
'rxjs/ajax': { main: 'index.js', defaultExtension: 'js' },
'rxjs/webSocket': { main: 'index.js', defaultExtension: 'js' }
}
Follow this official guidance to properly update your angular project:
https://update.angular.io/
You just need to select which version you are migrating from and your package manager (npm/yarn).
Then you'll have a list of things to do or check in order to have all set.
update check list

How to install all the dependencies and plugins using package.json in ionic

I have cloned ionic project from git in which the node_modules, platforms, plugins are not available but in the package.json i am having all the detail so whether i have to install all one by one or is there any short way where i can use the package.json and install all the node_modules, platforms and plugins.
package.json
{
"private": true,
"engines": {
"node": ">=4.0.0"
},
"scripts": {
"test": "gulp build --minify && gulp karma"
},
"devDependencies": {
"browser-sync": "^2.8.3",
"chalk": "^1.1.0",
"cordova": "^6.0.0",
"del": "^2.0.0",
"elementtree": "^0.1.6",
"eslint": "^3.0.0",
"gulp": "^3.9.1",
"gulp-angular-filesort": "^1.1.1",
"gulp-autoprefixer": "^3.0.1",
"gulp-changed": "^1.3.0",
"gulp-csso": "^2.0.0",
"gulp-eslint": "^3.0.0",
"gulp-filter": "^4.0.0",
"gulp-htmlmin": "^2.0.0",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^3.0.1",
"gulp-inject": "^4.0.0",
"gulp-jsonlint": "^1.1.0",
"gulp-load-plugins": "^1.0.0-rc",
"gulp-natural-sort": "^0.1.0",
"gulp-ng-annotate": "^2.0.0",
"gulp-plumber": "^1.0.1",
"gulp-protractor": "^3.0.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^3.1.0",
"gulp-shell": "^0.5.1",
"gulp-size": "^2.0.0",
"gulp-sourcemaps": "^1.5.2",
"gulp-uglify": "^2.0.0",
"gulp-useref": "^3.0.4",
"karma": "^1.1.0",
"karma-angular-filesort": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-ng-html2js-preprocessor": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"lodash": "^4.3.0",
"main-bower-files": "^2.9.0",
"minimist": "^1.2.0",
"phantomjs-prebuilt": "^2.1.4",
"plist": "git://github.com/akofman/plist.js.git#3f256fd21ab3ad3ada0f491cfc905098a2631342",
"proxy-middleware": "^0.15.0",
"require-dir": "^0.3.0",
"vinyl-paths": "^2.0.0",
"wiredep": "^4.0.0",
"xml2js": "^0.4.9",
"yeoman-test": "^1.1.0"
},
"generator-m-ionic": {
"proxies": [
{
"proxyMapFrom": "/postman-proxy",
"proxyMapTo": "https://echo.getpostman.com"
},
{
"proxyMapFrom": "/another-proxy",
"proxyMapTo": "https://echo.getpostman.com"
}
]
},
"dependencies": {
"angular-multiple-select": "^1.1.2",
"cordova-android": "^6.2.3",
"cordova-ios": "~4.3.1",
"cordova-plugin-device": "~1.1.5",
"cordova-plugin-network-information": "~1.3.2",
"cordova-plugin-whitelist": "1",
"cordova-plugin-x-toast": "~2.6.0",
"ionic-plugin-keyboard": "~2.2.1",
"pdfmake": "^0.1.31"
},
"cordova": {
"plugins": {
"cordova-plugin-x-toast": {},
"cordova-plugin-device": {},
"cordova-plugin-network-information": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {}
},
"platforms": [
"android",
"ios"
]
}
}
First install both ionic and cordova cli.(It is an ionic v1 project with android/ios platforms) from your package.json.
npm i -g cordova ionic
To install dependencies and devDependencies, do:
npm install
To install plugins and platforms as per package.json,
ionic cordova prepare
You may use the npm install command,
which will install all of the project dependencies locally.
npm official docs description for npm install command:
This command installs a package, and any packages that it depends on.
If the package has a package-lock or shrinkwrap file, the installation
of dependencies will be driven by that, with an npm-shrinkwrap.json
taking precedence if both files exist. See package-lock.json and
npm-shrinkwrap.
source

TypeError: Cannot read property 'length' of undefined (Converting angular to angular 4)

TypeError: Cannot read property 'length' of undefined
Console log
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15457:109)
at parseSourceFileWorker (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15389:26)
at Object.parseSourceFile (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15338:26)
at Object.createSourceFile (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15192:29)
at new TypeScriptFileRefactor (c:\Users\Amina\Desktop\LendingTree\node_modules\#ngtools\webpack\src\refactor.js:34:35)
at Object.resolveEntryModuleFromMain (c:\Users\Amina\Desktop\LendingTree\node_modules\#ngtools\webpack\src\entry_resolver.
js:105:20)
at AotPlugin._setupOptions (c:\Users\Amina\Desktop\LendingTree\node_modules\#ngtools\webpack\src\plugin.js:152:50)
at new AotPlugin (c:\Users\Amina\Desktop\LendingTree\node_modules\#ngtools\webpack\src\plugin.js:27:14)
at _createAotPlugin (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\models\webpack-configs\typescript.js:55:
12)
at Object.exports.getNonAotConfig (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\models\webpack-configs\typ
escript.js:71:19)
at NgCliWebpackConfig.buildConfig (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\models\webpack-config.js:2
9:37)
at Class.run (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\tasks\serve.js:43:98)
at check_port_1.checkPort.then.port (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\commands\serve.js:114:26
)
at process._tickCallback (internal/process/next_tick.js:109:7)
Package.Json
{
"name": "lending-tree",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#agm/core": "^1.0.0-beta.1",
"#angular/animations": "^4.2.4",
"#angular/common": "^4.2.4",
"#angular/compiler": "^4.2.4",
"#angular/core": "^4.2.4",
"#angular/forms": "^4.2.4",
"#angular/http": "^4.2.4",
"#angular/platform-browser": "^4.2.4",
"#angular/platform-browser-dynamic": "^4.2.4",
"#angular/router": "^4.2.4",
"#types/googlemaps": "^3.29.0",
"core-js": "^2.4.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "1.3.1",
"#angular/compiler-cli": "^4.2.4",
"#angular/language-service": "^4.2.4",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "~3.1.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
}
}
I have created a new project with cli ng new projectName
Replaced app folder with my existing project.
Added template for front view in the root directory of an application.
Updated index.html only added some css and scripts.
Moved main.ts src to app folder, and changed the imports statements.
That are only changes, I have made so far.