Issue with loading third party library which is dependence on another third party library. In my case, i'm using bootstrap(v3.3.7) which is required JQuery. I included these libraries as per angular suggested way and successfully compile the application, if run it in browser i got a console error.
Versions
"dependencies": {
"#angular/animations": "^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/platform-browser": "^6.0.0",
"#angular/platform-browser-dynamic": "^6.0.0",
"#angular/router": "^6.0.0",
"#types/bootstrap": "^3.3.33",
"#types/jquery": "^3.3.1",
"bootstrap": "^3.3.7",
"core-js": "^2.5.4",
"jquery": "3.3.1",
"malihu-custom-scrollbar-plugin": "3.1.5",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26" }
Sample code and console error
app.component.ts
import { Component, ElementRef, OnInit, AfterViewInit } from
'#angular/core';
import * as $ from 'jquery';
#Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
title = 'app';
constructor(private element: ElementRef){ }
ngOnInit() {
$('.dropdown-toggle').dropdown();
}
}
angular.json
"options": {
"outputPath": "dist/ang6",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
{ "input": "node_modules/bootstrap/dist/css/bootstrap.min.css" },
{ "input": "src/styles.css" }
],
"scripts": [
{ "input": "node_modules/jquery/dist/jquery.js" },
{ "input": "node_modules/bootstrap/dist/js/bootstrap.min.js" }
]
},
console error
error_message_pic
Is angular 6 changed the way of load/include the third party library files? Can anyone please help me to resolve this issue?
Related
I have a project to do. The Angular project was already set up when I started working. However, the animations do not seem to work properly. When I put a mat input placeholder, the placeholder doesn't disappear when I start writing in it. When I put a mat-select, the select doesn't drop down.
There's my package.json:
{
"name": "projetwifi-dashboard",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"serve": "ng serve --configuration=dev",
"start": "node server.js",
"build": "ng build",
"build:dev": "ng build --prod --configuration=dev",
"build:accept": "ng build --prod --configuration=accept",
"build:prod": "ng build --prod --configuration=production",
"test": "ng test",
"test:ci": "ng test --code-coverage=true --watch=false",
"lint": "ng lint && prettier -l \"**/*.ts\"",
"lint-fix": "ng lint --fix && prettier \"**/*.ts\" --write",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "~10.2.0",
"#angular/cdk": "^12.0.0",
"#angular/common": "~10.2.0",
"#angular/compiler": "^10.2.5",
"#angular/core": "~10.2.0",
"#angular/forms": "~10.2.0",
"#angular/material": "^10.2.7",
"#angular/platform-browser": "~10.2.0",
"#angular/platform-browser-dynamic": "~10.2.0",
"#angular/router": "~10.2.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-prom-bundle": "^6.2.0",
"googleapis": "^74.2.0",
"prom-client": "^12.0.0",
"puppeteer": "^5.4.1",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.1002.3",
"#angular/cli": "~10.2.0",
"#angular/compiler-cli": "^10.2.5",
"#types/jasmine": "~3.5.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"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",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
}
}
I have tried many version of the dependencies but nothing seems to resolve the problem. Any ideas? Thanks
welcome to the SO community! In order to answer your question, I'm gonna have to take a guess, since you didn't provide us with a minimum reproducible example.
Usually, in order for angular animations to work, you have to include BrowserAnimationsModule as stated by the documentation.
Here's how I would do that:
import { NgModule } from '#angular/core';
import { BrowserModule } from '#angular/platform-browser';
import { BrowserAnimationsModule } from '#angular/platform-browser/animations';
#NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule
],
declarations: [ ],
bootstrap: [ ]
})
export class AppModule { }
Once you have that, you'll be able to work with Angular animations. Please use the link above to see how it fully works, but essentially, my hunch is that you didn't include this module and hence, your animations don't work. The guide I've given is the official Angular documentation, and it should help you get started.
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".
I am struggling to listen to the message I am getting from a .net application using signalR on angular 6 application.
In angular.json file I have added /node_modules/signalr/jquery.signalR.min.js & jquery
Package.json includes
"dependencies": {
"#angular/animations": "^6.0.0",
"#angular/cdk": "^6.3.1",
"#angular/common": "^6.0.0",
"#angular/compiler": "^6.0.0",
"#angular/core": "^6.0.0",
"#angular/flex-layout": "^6.0.0-beta.16",
"#angular/forms": "^6.0.0",
"#angular/http": "^6.0.0",
"#angular/material": "^6.3.1",
"#angular/platform-browser": "^6.0.0",
"#angular/platform-browser-dynamic": "^6.0.0",
"#angular/router": "^6.0.0",
"#fortawesome/fontawesome-free-webfonts": "^1.0.9",
"#ng-bootstrap/ng-bootstrap": "^3.2.2",
"#ngrx/effects": "^6.0.0",
"#ngrx/store": "^6.0.0",
"#types/jquery": "^3.3.31",
"#types/signalr": "^2.2.35",
"ag-grid-angular": "^20.2.0",
"ag-grid-community": "^20.2.0",
"bootstrap": "^4.1.1",
"browser-detect": "^0.2.27",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"jquery": "^3.3.1",
"material-icons": "^0.2.3",
"ngx-toastr": "^10.0.4",
"popper.js": "^1.14.3",
"rxjs": "6.0.0",
"signalr": "^2.4.1",
"uuid": "^3.1.0",
"web-animations-js": "^2.2.5",
"zone.js": "^0.8.20"
}
Service file:
import { Injectable } from '#angular/core';
declare var $: any;
#Injectable({
providedIn: 'root'
})
export class SignalRServiceService {
private connection: any;
private proxy: any;
private url = 'https://localhost:8090';
constructor() {}
public startConnection(): void {
this.connection = $.hubConnection(this.url);
this.proxy = this.connection.createHubProxy('testhub');
// connection starts
this.connection.start().done((data: any) => {
console.log('Connected to Hub');
}).catch((error: any) => {
console.log('Hub error -> ' + error);
});
this.connection.proxies.testHub.on('databaseUpdateNotification', () => {
console.log('captured response');
});
}
}
I am able to see the 'Connected to Hub' message in console. I believe there is no connection issue. When .net some message broadcaster broadcasting I am not able to capture the response.
How to capture the response here?
Appreciate all your help....
Thanks a ton
On your method change to:
this.connection.proxies.testHub.on('databaseUpdateNotification', (data) => {
console.log(data);
});
I have a Progressive Web App in Angular 6 that includes an audio HTML5 tag to play some sounds. I deploy it to Firebase.
The problem I have is in Safari Browser (Mobile and Desktop, latest versions). Somehow the Service Worker makes that a "Live Broadcast"
message appears on the rendered audio tag when you try to play the sound (or even before you try to click on play button).
I don't get this "error" in Chrome, only in Safari.
I published an example app so that you can see the problem (remember
to visit the app from a Safari browser).
Example Firebase App
In this repository you can find the code of the example app.
Example App code repository
The "Live broadcast" message is something like this: Live Broadcast
message in Safari
I need that users can play the audio without getting that "Live Broadcast" text on the HTML5 audio player. I think it is something related with the Service Worker configuration, I'm not sure though. It might be an Angular problem too.
Any help would be really appreciated.
Details
Versions:
Angular version: 6.0.1
angular/cli version: 6.0.1
Node version: 8.11.1
npm version: 5.6.0
To build the app I use: (If I don't use --prod option I don't get the "Live Broadcast" message because the service worker is not
included when you don't use it)
ng build --prod
app.component.html
<div height="300px;">
<audio controls #audio123 controlsList="nodownload"
src="https://firebasestorage.googleapis.com/v0/b/angular-ng-build-
safari.appspot.com/o/-%20GIN%20-%20Testing%20Lakewood%20M31-CP%20(online-audio-converter.com).mp3?alt=media&token=1ba5f53e-58d3-43fe-b058-a6de05a51c29" preload="metadata">
</audio>
</div>
app.module.ts
import { BrowserModule } from '#angular/platform-browser';
import { NgModule } from '#angular/core';
import { AppComponent } from './app.component';
import { ServiceWorkerModule } from '#angular/service-worker';
import { environment } from '../environments/environment';
#NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
package.json
{
"name": "ng-build-sw-problem",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^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/platform-browser": "^6.0.0",
"#angular/platform-browser-dynamic": "^6.0.0",
"#angular/pwa": "^0.6.1",
"#angular/router": "^6.0.0",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26",
"#angular/service-worker": "^6.0.0"
},
"devDependencies": {
"#angular/compiler-cli": "^6.0.0",
"#angular-devkit/build-angular": "~0.6.1",
"typescript": "~2.7.2",
"#angular/cli": "~6.0.1",
"#angular/language-service": "^6.0.0",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1"
}
}
ngsw-conf.json
{
"index": "/index.html",
"assetGroups": [{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**"
]
}
}]
}
Trying to build a simple Angular 2 app with modal dialogs using 'ng2-bs3-modal'
index.html
<!doctype html>
<html>
<head>
<title>Angular 2 QuickStart</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order -->
<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/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
<script src="node_modules/ng2-bs3-modal/bundles/ng2-bs3-modal.js"></script>
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/main')
.then(null, console.error.bind(console));
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
package.json
{
"name": "ng2-test",
"version": "1.0.0",
"scripts": {
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"typings": "typings",
"postinstall": "typings install"
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.17",
"systemjs": "0.19.27",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "0.6.12"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings":"^1.0.4"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
typings.json
{
"ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2"
}
}
app/main.ts
import {bootstrap} from 'angular2/platform/browser' // import bootstrap
import {AppComponent} from './app.component' // import the component we just created
import {AComponent} from './a.component' //
//import {UserLoginModalComponent} from './user-login.component' //
bootstrap(AppComponent); // finally bootstrap it.
bootstrap(AComponent);
//bootstrap(UserLoginModalComponent);
app/app.component.ts
import {Component} from 'angular2/core'; // <-- importing Component from core
//import {AComponent} from './a.component';
#Component({
selector: 'my-app', //<----the element defined in the index.html
template: '<h1>Angular2, Hello {{name}}</h1><br>' // <---this is the template to put in the component.
// directives: [AComponent],
})
export class AppComponent {
name: string;
constructor(){
this.name = "ANIL";
}
} // <--- we need to export the class AppComponent.
app/a.component.ts
import {Component} from 'angular2/core'; // <-- importing Component from core
//import {AComponent} from './a.component';
#Component({
selector: 'my-app', //<----the element defined in the index.html
template: '<h1>Angular2, Hello {{name}}</h1><br>' // <---this is the template to put in the component.
// directives: [AComponent],
})
export class AppComponent {
name: string;
constructor(){
this.name = "ANIL";
}
} // <--- we need to export the class AppComponent.
app/user-login.component.ts
import {Component} from 'angular2/core';
import {MODAL_DIRECTIVES, ModalComponent} from 'ng2-bs3-modal/ng2-bs3-modal';
#Component({
selector: 'user-login-modal',
directives: [MODAL_DIRECTIVES],
template: `
<modal #modal [keyboard]="false" [backdrop]="'static'">
<modal-header [show-close]="false">
<h4 class="modal-title">I am a modal!</h4>
</modal-header>
<modal-body>
Hello World!
</modal-body>
<modal-footer [show-default-buttons]="true"></modal-footer>
</modal>
`
})
export class UserLoginModalComponent {
#ViewChild(ModalComponent)
modal: ModalComponent;
open(){
this.modal.open();
}
close(){
this.modal.close();
}
}
I see ng2-bs3-modal module is still trying to access #angular/core, i think it should point to angular2/core?
I also tried adding 'map' in system config js, but it was not taking the '.js' extension while accessing the #angular/core(even though defaultExtension: 'js' was present in system config js).
Please help!!!
Below is console log trace,
angular2-polyfills.js:127 GET http://localhost:3000/#angular/core 404 (Not Found)scheduleTask # angular2-polyfills.js:127ZoneDelegate.scheduleTask # angular2-polyfills.js:362Zone.scheduleMacroTask # angular2-polyfills.js:299(anonymous function) # angular2-polyfills.js:148send # VM1684:3fetchTextFromURL # system.src.js:1156(anonymous function) # system.src.js:1739ZoneAwarePromise # angular2-polyfills.js:610(anonymous function) # system.src.js:1738(anonymous function) # system.src.js:2764(anonymous function) # system.src.js:3338(anonymous function) # system.src.js:3605(anonymous function) # system.src.js:3990(anonymous function) # system.src.js:4453(anonymous function) # system.src.js:4705(anonymous function) # system.src.js:408ZoneDelegate.invoke # angular2-polyfills.js:349Zone.run # angular2-polyfills.js:242(anonymous function) # angular2-polyfills.js:597ZoneDelegate.invokeTask # angular2-polyfills.js:382Zone.runTask # angular2-polyfills.js:282drainMicroTaskQueue # angular2-polyfills.js:500ZoneTask.invoke # angular2-polyfills.js:452
angular2-polyfills.js:349 Error: Error: XHR error (404 Not Found) loading http://localhost:3000/#angular/core(…)
Very silly of me, missed to include the bootstrap CSS
https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css
and add ng2-bs3-modal latest version(it looks for #angular/ packages not angular/
"ng2-bs3-modal": "^0.6.1"
used mapping for angular rc version in system config js as below
var map = {
'app': 'app', // 'dist',
'#angular': 'node_modules/#angular',
'angular2': 'node_modules/#angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs'
};
and
package.json
"dependencies": {
"#angular/common": "2.0.0-rc.1",
"#angular/compiler": "2.0.0-rc.1",
"#angular/core": "2.0.0-rc.1",
"#angular/http": "2.0.0-rc.1",
"#angular/platform-browser": "2.0.0-rc.1",
"#angular/platform-browser-dynamic": "2.0.0-rc.1",
"#angular/router": "2.0.0-rc.1",
"#angular/router-deprecated": "2.0.0-rc.1",
"#angular/upgrade": "2.0.0-rc.1",
"ng2-bs3-modal": "^0.6.1",
"systemjs": "0.19.27",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.10",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings": "^1.0.4",
"canonical-path": "0.0.2",
"http-server": "^0.9.0"
},