angular6

Angular 8, can checkbox value pass onto components? not not in a parent/child relation

若如初见. 提交于 2020-01-16 11:58:21
问题 <input type=checkbox [(ngModel)]="myCheckBox" (ngChanged)="!myCheckBox"> for example, if I want the code above to pass the "checked" value, which is "true or false" to other components, so its contents can react based on "myCheckBox" true | false, and they are not in a parent child relationship, is there any way I can do that? Please help, really apprecipate it!!!! 回答1: You can implement it by different methods. For example: with EventEmitter or rxjs( Subject, BehaviourSubject); In my example

UTC date for mat-date picker in angular 6

 ̄綄美尐妖づ 提交于 2020-01-16 09:14:53
问题 i have used mat-datepicker for my angular 6 project.But in date picker in is showing current timezone date.Instead of this i need to display current UTC date. Here is my code .ts file var nowDate = new Date(); this.startdate = nowDate; this.enddate = nowDate; .html file <mat-form-field style="margin-right: 25px;"> <input matInput [matDatepicker]="picker_start" placeholder="Start Date" [(ngModel)]="startdate" [ngModelOptions]="{timezone: 'UTC'}"> <mat-datepicker-toggle matSuffix [for]="picker

How to plot data on time differences?

久未见 提交于 2020-01-16 08:09:31
问题 I have multiple data on each date for example i have 6 data values those need to plot single date. How would i plot them? I am passing millisecond values in date in ForLoop under generateChartData() function : let newDate = new Date(parseInt(this.vitalHistoryEachData[i]['observation-time'])); //1504549740000,1504535400000,1504532700000,1504530900000 newDate.setDate(newDate.getDate()); // output Mon Sep 04 2017 23:59:00 GMT+0530 (India Standard Time), Mon Sep 04 2017 20:00:00 GMT+0530 (India

How to plot data on time differences?

。_饼干妹妹 提交于 2020-01-16 08:09:09
问题 I have multiple data on each date for example i have 6 data values those need to plot single date. How would i plot them? I am passing millisecond values in date in ForLoop under generateChartData() function : let newDate = new Date(parseInt(this.vitalHistoryEachData[i]['observation-time'])); //1504549740000,1504535400000,1504532700000,1504530900000 newDate.setDate(newDate.getDate()); // output Mon Sep 04 2017 23:59:00 GMT+0530 (India Standard Time), Mon Sep 04 2017 20:00:00 GMT+0530 (India

Angular 6 patchValue Not Setting..sometimes

一世执手 提交于 2020-01-15 12:26:07
问题 I have a basic form shown below. I make a call to an API to grab the user's personal info and I want to fill the form fields with the appropriate values. I have been trying to use patchValue but I cannot get it to work. <form (ngSubmit)="onSubmit" class="example-form" [formGroup]="firstFormGroup" #registerForm="ngForm"> <mat-form-field class="example-full-width"> <input matInput placeholder="Company" formControlName="company" required autofocus> <mat-error *ngIf="firstFormGroup.get('company')

Why my file app.component.html is not working?

廉价感情. 提交于 2020-01-15 11:56:07
问题 My basic angular app is not displaying the app.component.html content, always I have the content of index html. Index HTML: <!DOCTYPE html> <html> <head> <title>Angular 6</title> <base href="/"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="styles.css"> <!-- Polyfill(s) for older browsers --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.js"></script>

Can we use multiple libraries in angular(2/4/5/6) because it supports TreeShaking ? Without hitting the performance and build size

你说的曾经没有我的故事 提交于 2020-01-15 09:42:08
问题 I have gone through this article : https://www.reddit.com/r/Angular2/comments/6a678s/primeng_vs_material2/ In the comment they mentioned we can use Prime Ng and Angular material together in app. In PrimeNg components are standalone modules mostly so you can add only the ones you need and same is true for Angular material after couple of updates. My question is... Can we use multiple number of libraries as many as we want with Angular app Like: PrimeNg, Angular material, Fuse and many more.

How to format dates in Angular 6?

坚强是说给别人听的谎言 提交于 2020-01-15 08:21:54
问题 I have a function which displays real time dates from entered input by user, right now when user enter the input I have something like this in front end displayed [date]: 28.10.2018 10:09 I would like the date to change if its past days , past week, past year etc so if input was entered yesterday I would like to display something like this: 1d meaning one day ago , the same goes for year ( 1y ) , for week ( 1w ) etc. Here is what I have tried so far: Here is the function for grabing the date

Angular 6: how to access ALL option values in mat-autocomplete dropdown?

柔情痞子 提交于 2020-01-15 03:32:06
问题 Given the example in the Angular docs you can see here and also repeated below, how can I access the rest of the object data in options ? If for example, the object was more than just a simple list of names in key:value format, but something more complex such as data coming in from an API: dataObject = { name: 'someName', nameID: 'someId', foo: 'bar' } The example in the docs is too simple and isn't telling me how to get the name to display in the input field, and to also get the

Angular 6: Cannot read property 'runOutsideAngular' of undefined

泄露秘密 提交于 2020-01-14 14:13:00
问题 I have created nav-bar using cli through this command ng g @angular/material:material-nav --name=version-nav and imported in my component as <app-version-nav></app-version-nav> and got this error any helpful suggestion would be highly appreciated 回答1: You can change target to es5 in tsconfig.js { "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "module": "es2015", "moduleResolution": "node",