Angular 6 Material StaticInjectorError NgZone - angular-material2

After migrating from Angular 5 to Angular 6 all my Material component do not work anymore - again... ...yet this time I am really clueless about what could cause the problem anymore. I invested half a day investigating and created a stripped-down project in order to reproduce the problem in its essence.
Let me show you the various file contents:
package.json
{
"name": "xxx",
"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": {
"#angular/animations": "^6.0.9",
"#angular/cdk": "^6.4.0",
"#angular/common": "^6.0.9",
"#angular/compiler": "^6.0.9",
"#angular/core": "^6.0.9",
"#angular/forms": "^6.0.9",
"#angular/http": "^6.0.9",
"#angular/material": "^6.4.0",
"#angular/platform-browser": "^6.0.9",
"#angular/platform-browser-dynamic": "^6.0.9",
"#angular/platform-server": "^6.0.9",
"#angular/router": "^6.0.9",
"#ngtools/webpack": "1.8.0",
"#types/node": "~6.0.60",
"#types/webpack-env": "1.13.0",
"angular2-template-loader": "0.6.2",
"aspnet-prerendering": "^3.0.1",
"aspnet-webpack": "^2.0.1",
"awesome-typescript-loader": "3.2.1",
"codelyzer": "~3.2.0",
"css": "2.2.1",
"css-loader": "0.28.4",
"es6-shim": "0.35.3",
"event-source-polyfill": "0.0.9",
"expose-loader": "0.7.3",
"extract-text-webpack-plugin": "2.1.2",
"file-loader": "0.11.2",
"html-loader": "0.4.5",
"isomorphic-fetch": "2.2.1",
"jquery": "3.2.1",
"json-loader": "0.5.4",
"preboot": "4.5.2",
"protractor": "~5.1.2",
"raw-loader": "0.5.1",
"reflect-metadata": "0.1.10",
"rxjs": "^6.2.2",
"style-loader": "0.18.2",
"to-string-loader": "1.1.5",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.7.2",
"url-loader": "0.5.9",
"webpack": "2.5.1",
"webpack-hot-middleware": "2.18.2",
"webpack-merge": "4.1.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular/cli": "^6.0.8",
"#angular/compiler-cli": "^6.0.9",
"#angular/language-service": "^6.0.9",
"#types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0"
}
}
app.module
import { NgModule } from '#angular/core';
import { MatDialogModule } from '#angular/material';
import { CommonModule } from '#angular/common';
import { RouterModule } from '#angular/router';
import { AppComponent } from './components/app/app.component';
import { MessageFormComponent } from './components/common/forms/message.component';
#NgModule({
declarations: [
AppComponent,
MessageFormComponent,
],
imports: [
CommonModule,
MatDialogModule,
RouterModule.forRoot([
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: MessageFormComponent },
{ path: '**', redirectTo: 'home' }
]),
]
})
export class AppModuleShared {
}
message.component.ts
import { Component } from '#angular/core';
import { MatDialog, MAT_DIALOG_DATA } from '#angular/material';
#Component({
selector: 'message-form',
template: 'blubb',
})
export class MessageFormComponent {
constructor(private alert: MatDialog) { } // this line causes the problem
}
As soon as I make ANYTHING with the material - this error occurs. I am good in programming angular programs - not so good in fiddling around with the NEVER WORKING infrastructure... ;-)

Related

Error:Angular JIT compilation failed:'#angular/compiler' not loaded!JIT compilation is discouraged for production use-cases! Consider AOT mode instead

my app doesn't work in production in heroku but works fine in local
my Package.json file:
{ "name": "Medica_Ligne", "version": "0.0.9", "scripts": { "ng": "ng", "start": "node server.js", "build": "ng build", "watch": "ng build --watch --configuration development", "heroku-postbuild":"ng build --prod --aot", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "#angular/cli": "~12.0.1", "#angular/compiler": "~12.0.1", "#angular/common": "~12.0.1", "#angular/compiler-cli": "~12.0.1", "#angular/core": "~12.0.1", "#angular/flex-layout": "^2.0.0-beta.10-4905443", "#angular/forms": "~12.0.1", "#angular/http": "^7.2.16", "#angular/platform-browser": "~12.0.1", "#angular/platform-browser-dynamic": "~12.0.1", "#angular/router": "~12.0.1", "#ionic-native/android-permissions": "^5.33.1", "#ionic-native/base64": "^5.33.1", "#ionic-native/camera": "^5.36.0", "#ionic-native/core": "^5.33.1", "#ionic-native/date-picker": "^5.33.1", "#ionic-native/email-composer": "^5.36.0", "#ionic-native/fcm": "^5.36.0", "#ionic-native/file": "^5.33.1", "#ionic-native/file-transfer": "^5.33.1", "#ionic-native/ionic-webview": "^5.36.0", "#ionic-native/keyboard": "^5.36.0", "#ionic-native/media": "^5.33.1", "#ionic-native/media-capture": "^5.33.1", "#ionic-native/native-audio": "^5.36.0", "#ionic-native/pdf-generator": "^5.36.0", "#ionic-native/splash-screen": "^5.33.1", "#ionic-native/status-bar": "^5.33.1", "#ionic/angular": "^5.5.2", "#ionic/storage": "^2.2.0", "#ngx-translate/core": "^14.0.0", "#ngx-translate/http-loader": "^7.0.0", "cocoapods": "^0.0.0", "express": "^4.18.2", "file-saver": "^2.0.5", "ngx-pagination": "^5.1.1", "ngx-quill": "^5.2.0", "path": "^0.12.7", "quill": "^1.3.7", "rxjs": "~6.5.1", "rxjs-compat": "^6.6.7", "tslib": "^2.0.0", "typescript": "~4.2.4", "zone.js": "~0.11.4" }, "devDependencies": { "#angular-devkit/build-angular": "~12.0.1", "#angular-eslint/builder": "~12.0.0", "#angular-eslint/eslint-plugin": "~12.0.0", "#angular-eslint/eslint-plugin-template": "~12.0.0", "#angular-eslint/template-parser": "~12.0.0", "#angular/cli": "~12.0.1", "#angular/compiler": "~12.0.1", "#angular/compiler-cli": "~12.0.1", "#angular/language-service": "~12.0.1", "#ionic/angular-toolkit": "^4.0.0", "#types/jasmine": "~3.6.0", "#types/jasminewd2": "~2.0.3", "#typescript-eslint/eslint-plugin": "4.16.1", "#typescript-eslint/parser": "4.16.1", "com-badrit-base64": "^0.2.0", "cordova-android": "^9.0.0", "cordova-browser": "^6.0.0", "cordova-ios": "^6.2.0", "cordova-pdf-generator": "^2.1.1", "cordova-plugin-android-permissions": "^1.1.2", "cordova-plugin-androidx": "^3.0.0", "cordova-plugin-androidx-adapter": "^1.1.3", "cordova-plugin-camera": "^5.0.3", "cordova-plugin-datepicker": "^0.9.3", "cordova-plugin-device": "^2.0.2", "cordova-plugin-email-composer": "^0.10.0", "cordova-plugin-fcm-with-dependecy-updated": "^7.8.0", "cordova-plugin-file": "^6.0.2", "cordova-plugin-file-opener2": "^3.0.5", "cordova-plugin-file-transfer": "^1.7.1", "cordova-plugin-ionic-keyboard": "^2.2.0", "cordova-plugin-ionic-webview": "^5.0.0", "cordova-plugin-media": "^5.0.3", "cordova-plugin-media-capture": "^3.0.3", "cordova-plugin-nativeaudio": "^3.0.9", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-plugin-whitelist": "^1.3.3", "cordova-sqlite-storage": "^6.0.0", "eslint": "^7.6.0", "eslint-plugin-import": "2.22.1", "eslint-plugin-jsdoc": "30.7.6", "eslint-plugin-prefer-arrow": "1.2.2", "jasmine-core": "~3.7.1", "jasmine-spec-reporter": "~5.0.0", "karma": "~6.3.2", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", "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", "typescript": "~4.2.4" }, "engines":{ "npm":"9.4.0", "node":"16.13.2" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-splashscreen": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-datepicker": {}, "cordova-plugin-whitelist": {}, "cordova-plugin-device": {}, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-media": {}, "cordova-plugin-file": {}, "cordova-plugin-file-transfer": {}, "com-badrit-base64": {}, "cordova-plugin-media-capture": {}, "cordova-plugin-android-permissions": {}, "cordova-sqlite-storage": {}, "cordova-plugin-nativeaudio": {}, "cordova-pdf-generator": {}, "cordova-plugin-camera": { "ANDROID_SUPPORT_V4_VERSION": "27.+" }, "cordova-plugin-email-composer": {}, "cordova-plugin-androidx-adapter": {}, "cordova-plugin-androidx": {}, "cordova-plugin-file-opener2": { "ANDROID_SUPPORT_V4_VERSION": "27.+" }, "cordova-plugin-ionic-webview": {}, "cordova-plugin-fcm-with-dependecy-updated": { "ANDROID_DEFAULT_NOTIFICATION_ICON": "#mipmap/ic_launcher", "ANDROID_FCM_VERSION": "21.0.0", "ANDROID_FIREBASE_BOM_VERSION": "26.0.0", "ANDROID_GOOGLE_SERVICES_VERSION": "4.3.4", "ANDROID_GRADLE_TOOLS_VERSION": "4.1.0" } }, "platforms": [ "ios", "browser", "android" ] } }
I did try to set aot=true in angular.json

Problem to capture ChromeHeadless launcher Using Puppeteer

can someone help me in this issue?
I am getting the '[launcher]: ChromeHeadless have not captured in 60000 ms, killing.' when the pipeline (Jenkins) is trying to exec the tests with karma (Puppeteer using ChromeHeadless)
We have as demmand of the client to change the launcher from Phantomjs to ChromeHeadless;
We've tried a lot of things and nothing works until now and i have no idea how to solve it.
some informations about the project configurations:
We use angular 7, karma dependencies and puppeteer as follow :
package.json
{
"name": "xxxxxxxx",
"version": "0.0.0",
"license": "my",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test -c karma.conf.js -cc --browsers MyChromeHeadless",
"lint": "ng lint",
"e2e": "ng e2e"
},
"dependencies": {
"#angular-devkit/build-angular": "^0.13.9",
"#angular/animations": "7.2.15",
"#angular/common": "7.2.15",
"#angular/compiler": "7.2.15",
"#angular/core": "7.2.15",
"#angular/forms": "7.2.15",
"#angular/http": "7.2.15",
"#angular/platform-browser": "7.2.15",
"#angular/platform-browser-dynamic": "7.2.15",
"#angular/router": "7.2.15",
"#ng-bootstrap/ng-bootstrap": "1.0.0-beta.4",
"#ngx-translate/core": "^8.0.0",
"angl-spawebbgrl": "^6.2.0",
"angular2-text-mask": "^8.0.4",
"angular2-tinymce": "2.1.2",
"angular2-ui-switch": "^1.2.0",
"bootstrap": "^3.3.7",
"core-js": "2.4.1",
"font-awesome": "^4.7.0",
"intl": "^1.2.5",
"jquery": "^3.4.1",
"moment": "^2.24.0",
"ng2-bs3-modal": "^0.10.4",
"ng2-translate": "^5.0.0",
"ngx-bootstrap": "1.9.3",
"ngx-toastr": "^6.5.0",
"puppeteer": "^2.0.0",
"rxjs": "6.5.3",
"rxjs-compat": "^6.0.0-rc.0",
"text-mask-addons": "^3.7.0",
"tslib": "^1.9.0",
"xlsx": "^0.12.0",
"zone.js": "0.8.29"
},
"devDependencies": {
"#angular/cli": "^7.3.9",
"#angular/compiler-cli": "^7.2.15",
"#angular/language-service": "^7.2.15",
"#types/jasmine": "3.4.6",
"#types/jasminewd2": "2.0.8",
"#types/node": "8.10.59",
"bower-art-resolver": "^2.0.10",
"chai": "4.2.0",
"codelyzer": "3.0.1",
"jasmine-core": "3.5.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "^4.4.1",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "3.1.0",
"karma-cli": "2.0.0",
"karma-coverage": "^2.0.1",
"karma-coverage-istanbul-reporter": "2.1.0",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.2",
"karma-junit-reporter": "2.0.1",
"karma-mocha": "^1.1.1",
"karma-sinon": "1.0.5",
"mocha": "^6.2.2",
"mocha-junit-reporter": "1.23.1",
"protractor": "^6.0.0",
"selenium-webdriver": "^3.6.0",
"sinon": "1.17.5",
"ts-node": "3.0.4",
"tslint": "5.3.2",
"typescript": "^3.1.1"
},
"optionalDependencies": {
}
}
Our karma configuration:
karma.conf.js
module.exports = function (config) {
const process = require('process');
process.env.CHROME_BIN = require('puppeteer').executablePath();
config.set({
basePath: '',
frameworks: ['jasmine', '#angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-coverage'),
require('karma-coverage-istanbul-reporter'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('#angular-devkit/build-angular/plugins/karma')
],
files:[
'src/test.ts'
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true,
dir: 'coverage',
'report-config': { html: { subdir: 'html'} }
},
reporters: ['progress', 'kjhtml', 'coverage'],
port: 9876,
logLevel: config.LOG_DEBUG,
autoWatch: false,
singleRun: true,
browsers: ['MyChromeHeadless'],
customLaunchers: {
MyChromeHeadless: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--proxy-auto-detect'
]
}
}
});
};
This error occurs when jenkins try to exec the tests, but locally runs everything ok. This problem is specific of the pipeline that is running over a linux machine;
Has someone to help me to get '[launcher]: ChromeHeadless have not captured in 60000 ms, killing.' fixed?
Any advice will be welcome. Tkx!
Just checking, but are you sure a valid version of Chrome is installed on the pipelined machine, and that the path is set so the launcher can find it?
It sounds like the laucher is timing out just trying to fire up HC, and the most obvious issue whould be it not being able to find a version to run.
i discovered how to solve this issue.
The client has a proxy-blocker to manage the networking configurations. So i provided the proxy as server in the customLauncher flag and works perfectly, but only in the pipeline, locally the tests stopped. but it's just take off the proxy that runs locally.
Before: This way the tests runs locally, but do not works in the jenkins pipeline (npm run test)
browsers: ['MyChromeHeadless'],
customLaunchers: {
MyChromeHeadless: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--proxy-auto-detect'
]
}
}
After: This way the tests runs in the pipeline, but do not works locally cuz i'm not under the client networking with access to the proxy provied
browsers: ['MyChromeHeadless'],
customLaunchers: {
MyChromeHeadless: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--proxy-bypass-list=*',
'--proxy-server=http://proxy.your.company'
]
}
}

Property '_isScalar' is missing in type 'TodoItemNode[]'

I am trying to use Mat-tree module in my angular application, but getting compile time error:
Argument of type '(node: TodoItemNode) => TodoItemNode[]' is not assignable to parameter of type '(node: TodoItemNode) => Observable'. Type 'TodoItemNode[]' is not assignable to type 'Observable'. Property '_isScalar' is missing in type 'TodoItemNode[]'
Here is the link from where I have referred or copied the code for demo UI:
Angular Material Official Mat-Tree Example Link
Here is the code where it throws an error:
Login Report Component:
constructor(
private database: ChecklistDatabase
) {
this.treeFlattener = new MatTreeFlattener(this.transformer, this.getLevel,
this.isExpandable, this.getChildren); // This line
this.treeControl = new FlatTreeControl<TodoItemFlatNode>(this.getLevel, this.isExpandable);
this.dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
database.dataChange.subscribe(data => {
this.dataSource.data = data;
});
}
Edit:
transformer = (node: TodoItemNode, level: number) => {
const existingNode = this.nestedNodeMap.get(node);
const flatNode = existingNode && existingNode.item === node.item
? existingNode
: new TodoItemFlatNode();
flatNode.item = node.item;
flatNode.level = level;
flatNode.expandable = !!node.children;
this.flatNodeMap.set(flatNode, node);
this.nestedNodeMap.set(node, flatNode);
return flatNode;
}
And
getLevel = (node: TodoItemFlatNode) => node.level;
isExpandable = (node: TodoItemFlatNode) => node.expandable;
getChildren = (node: TodoItemNode): TodoItemNode[] => node.children;
MatTreeFlattener Constructor:
constructor(transformFunction: (node: T, level: number) => F, getLevel: (node: F) => number, isExpandable: (node: F) => boolean, getChildren: (node: T) => Observable<T[]>);
Package.Json
{
"name": "kalpavriksha-angular-v4",
"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",
"#agm/snazzy-info-window": "^1.0.0-beta.1",
"#angular/animations": "^5.0.0",
"#angular/cdk": "^6.0.0-beta.4",
"#angular/common": "^5.0.0",
"#angular/compiler": "^5.0.0",
"#angular/core": "^5.0.0",
"#angular/forms": "^5.0.0",
"#angular/http": "^5.0.0",
"#angular/material": "^6.0.0-beta.4",
"#angular/platform-browser": "^5.0.0",
"#angular/platform-browser-dynamic": "^5.0.0",
"#angular/platform-server": "^5.0.0",
"#angular/router": "^5.0.0",
"#swimlane/ngx-charts": "^6.1.0",
"#types/filesaver": "0.0.30",
"angular-chat": "^1.0.9",
"angular-datatables": "^4.2.0",
"angular-file-picker": "^1.2.0",
"angular-file-saver": "^1.1.3",
"angular-material": "^1.1.5",
"angularfire2": "5.0.0-rc.3",
"angularjs-bootstrap-datetimepicker": "^1.1.4",
"chart.js": "^2.7.2",
"chart.piecelabel.js": "^0.11.0",
"cloudboost": "^2.0.264",
"core-js": "^2.4.1",
"d3": "^4.11.0",
"datatables.net": "^1.10.16",
"datatables.net-buttons": "^1.4.2",
"datatables.net-buttons-dt": "^1.4.2",
"datatables.net-dt": "^1.10.16",
"datatables.net-select": "^1.2.3",
"datatables.net-select-dt": "^1.2.3",
"file-saver": "^1.3.3",
"firebase": "4.6.0",
"hammerjs": "^2.0.8",
"material-design-icons": "^3.0.1",
"md-date-picker": "^0.1.0",
"ng-chat": "^1.0.12",
"ng-snotify": "^4.0.0",
"ng2-charts": "^1.6.0",
"ng2-search-filter": "^0.3.1",
"ng4-loading-spinner": "^1.0.27",
"ngx-cookie-service": "^1.0.9",
"ngx-inactivity": "^1.0.1",
"ngx-loading": "^1.0.7",
"ngx-pagination": "^3.1.0",
"ngx-progress-bar": "0.0.10",
"rxjs": "^5.5.11",
"snazzy-info-window": "^1.1.0",
"time-ago-pipe": "^1.3.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "^1.4.1",
"#angular/compiler-cli": "^5.0.0",
"#angular/language-service": "^4.0.0",
"#types/datatables.net": "^1.10.6",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/jquery": "^3.2.12",
"#types/node": "~6.0.60",
"codelyzer": "~3.0.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.0.4",
"tslint": "~5.3.2",
"typescript": "2.4.2"
}
}
I was also getting the same Error for MAT-TREE
Solved by updating the Angular Material # package.json and Delete the Node Modules and npm install.
From "#angular/material": "^6.2.0" to=> "#angular/material": "^6.4.2"

Mobile browsers shows blank page for the vuetify application

Here is my package.json:
{
"name": "DFS",
"version": "1.0.0",
"description": "DFS App",
"author": "asd",
"private": true,
"nodemonConfig": {
"delay": "2500"
},
"scripts": {
"postinstall": "npm run build",
"dev": "node build/dev-server.js",
"start": "node build/dev-server.js",
"build": "node build/build.js",
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs",
"deploy": "git subtree push --prefix dist heroku master"
},
"dependencies": {
"axios": "^0.16.2",
"connect-history-api-fallback": "^1.5.0",
"express-sslify": "^1.2.0",
"global": "^4.3.2",
"heroku-ssl-redirect": "0.0.4",
"less": "^3.0.1",
"less-loader": "^4.0.5",
"node-sass": "^4.7.2",
"npm-watch": "^0.3.0",
"sass-loader": "^6.0.6",
"style-loader": "^0.20.2",
"vee-validate": "^2.0.0-rc.14",
"vue": "^2.3.3",
"vue-router": "^2.3.1",
"vuetify": "^1.0.3",
"vuex": "^3.0.1",
"webpack-dev-server": "^3.0.0",
"webpack-watch": "^0.2.0"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-istanbul": "^4.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chai": "^3.5.0",
"chalk": "^2.0.1",
"chromedriver": "^2.27.2",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.1",
"cross-spawn": "^5.0.1",
"css-loader": "^0.28.0",
"cssnano": "^3.10.0",
"eslint": "^3.19.0",
"eslint-config-standard": "^6.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-html": "^3.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eslint-plugin-vue": "^4.0.0",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"inject-loader": "^3.0.0",
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-shim": "^1.4.0",
"karma-sinon-chai": "^1.3.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "^2.0.2",
"lolex": "^2.0.0",
"mocha": "^3.2.0",
"nightwatch": "^0.9.12",
"node-notifier": "^5.1.2",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.2.0",
"phantomjs-prebuilt": "^2.1.15",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"sinon": "^2.1.0",
"sinon-chai": "^2.8.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"sw-precache-webpack-plugin": "^0.11.4",
"ts-loader": "^3.5.0",
"uglify-es": "^3.0.25",
"url-loader": "^0.5.8",
"vue-loader": "^12.1.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-bundle-analyzer": "^2.2.1",
"webpack-cli": "^2.0.9",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
My main.js:
import Vue from 'vue'
import Vuetify from 'vuetify' // eslint-disable-line no-unused-vars
// import App from './App'
// import router from './router'
Vue.use(Vuetify)
// Vue.config.productionTip = false
new Vue({ // eslint-disable-line no-new
el: '#app',
// router,
template: '<div>hi there</div>'
// components: { App },
// template: '<App/>'
})
My App.vue
<template>
<div>
123
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
I am using Heroku for the app hosting. When I try to visit site with desktop browser all is okay, but when I try to load it via mobile browser it shows the blank page.
For the other hand deploying this repo: https://github.com/deepak-singh/vue-blog-pwa
is successfully done and loading via mobile or desktop browser is successful.
Also I found that this line causes blank page in my vue app:
Vue.use(Vuetify)
But! This line is present in vue-pwa-blog repo file. So I can not understand what may I doing wrong?
This is happening because when a PWA is installed and opened on a phone it rewrites the URL to /index.html whereas the vuetify app is rendered at /.
Just re-adjust your vue-router to load the component at /index.html too and it should work.
Your router.js could look something like this:
{
path: '/',
name: 'App',
component: App
},
{
path: '/index.html',
name: 'App',
component: App
}
My routers are like this:
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '#/components/HelloWorld'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'HelloWorld',
component: HelloWorld
},
{
path: '/index.html',
name: 'HelloWorld',
component: HelloWorld
}
]
})
Still blank page.. If i remove my Vue.use(Vuetify) from main.js works..
Package.json ->
"dependencies": {
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vuetify": "^1.1.6"
},

Angular 2 Material How to update Dialog box Position?

Below is the simple Angular 2 code that should show dialog box in the middle out of the box. Instead dialog box show at the bottom.
I am using "angular-cli": "1.0.0-beta.24" and "#angular/material": "^2.0.0-beta.1"
Can anybody help why this is happening?
import { Component } from '#angular/core';
import {MdDialog,MdDialogRef,MdDialogConfig} from '#angular/material';
#Component({
selector: 'app-root',
template: `
<md-sidenav-container style="width:200px;height:500px;">
<md-sidenav mode="side" opened="true" #sidenav>
<md-nav-list>
<a md-list-item (click)="newItem()">
New
</a>
<a md-list-item>
Refresh
</a>
<a md-list-item>
Delete
</a>
</md-nav-list>
</md-sidenav>
</md-sidenav-container>
`,
})
export class AppComponent {
title = 'app works!';
constructor(public dialog: MdDialog) {}
newItem()
{
let dialogRef=this.dialog.open(RecordDialogComponent);
dialogRef.afterClosed().subscribe(result => {
});
}
}
#Component({
selector: 'record-dialog',
template: ` <h1 md-dialog-title>New Item</h1>
<md-dialog-actions>
<button (click)="dialogRef.close('save')">Save</button>
<button md-dialog-close>Cancel</button>
</md-dialog-actions>
`
})
export class RecordDialogComponent{
public title: string;
public message: string;
constructor(public dialogRef: MdDialogRef<RecordDialogComponent>) { }
}
Below is the package.json
{
"name": "materialt2",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"#angular/common": "^2.3.1",
"#angular/compiler": "^2.3.1",
"#angular/core": "^2.3.1",
"#angular/forms": "^2.3.1",
"#angular/http": "^2.3.1",
"#angular/material": "^2.0.0-beta.1",
"#angular/platform-browser": "^2.3.1",
"#angular/platform-browser-dynamic": "^2.3.1",
"#angular/router": "^3.3.1",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"#angular/compiler-cli": "^2.3.1",
"#types/jasmine": "2.5.38",
"#types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.24",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "~4.0.13",
"ts-node": "1.2.1",
"tslint": "^4.0.2",
"typescript": "~2.0.3"
}
}
Try this
const dialogRef = this.dialog.open(DialogComponentName, {
width: '250px'
position: { bottom: '0'}
});
You can also add left: 0 etc.
I had the same issue as you. This post helped me to solve it (although I think this isn't intended because it isn't described anywhere I looked): Angular2 Material: Md-Menu opens below router outlet
You need to include a theme from Angular Material as described here: https://github.com/angular/material2/blob/master/guides/theming.md
That fixed it for me.
You can change modal position using this code. Put this inside your md-dialog component.
import { MdDialog, MdDialogConfig, MdDialogRef } from '#angular/material';
constructor(public dialogRef: MdDialogRef<any>) { }
ngOnInit() {
this.dialogRef.updatePosition({ top: '25px', left: '25px' });
}
you can use updatePosition method anywhere inside dialog component.
for more information check this link https://material.angular.io/components/component/dialog

Resources