ngmodel

Angular `ng build --prod` issue

旧时模样 提交于 2019-12-25 01:44:50
问题 when i did --> 'ng build --prod' i got this error ERROR in : Cannot determine the module for class AppComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/app.component.ts! Add AppComponent to the NgModule to fix it. Cannot determine the module for class OfferCreationFinalForwarderComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/offer-creation-final- forwarder/offer-creation-final-forwarder.component.ts! Add OfferCreationFinalForwarderComponent to the NgModule to fix it.

Angular2 keyup event update ngModel cursor position jumps to end

好久不见. 提交于 2019-12-21 09:38:06
问题 I am having an issue with an Angular2 directive that should do the following: Detect if the user enters '.' character. If the next char is also '.', remove the duplicate '.' and move the cursor position to after the '.' char I have the above working, however, when using this in combination with ngModel, the cursor position jumps to the end every time the model is updated. The input: <input type="text" name="test" [(ngModel)]="testInput" testDirective/> The directive: import {Directive,

Multiple form controls in child component with control value accessor using Angular 5

不问归期 提交于 2019-12-13 03:36:18
问题 I want to implement a functionality with control value accessor in Angular 5. It's like to access multiple form control in child custom component from a parent. Please let me know if I can achieve this in another way. Template driven form compulsory. If there is any other any to generic create a custom control with two-way data binding, please let me know. It would great if answers are in Plunker or StackBlitz. Here is mine: https://stackblitz.com/edit/angular-qzioet Parent component :-

Angular 4 Select don't update on ngModel change

时光总嘲笑我的痴心妄想 提交于 2019-12-13 03:34:15
问题 I am trying to make that after new value is selected, I call eventChange() function and restore selected value to default. But what happens: ngModel value updates, but selected value stays the same. How should I do that selected value and ngModel value would be the same? HTML file <select [(ngModel)]="selectedValue" (change)="eventChange()" > <option [disabled]="true" [ngValue]="-1"> Choose an option </option> <option *ngFor="let item of myList index as i" [ngValue]="i" > {{item.name}} <

Why is ionic 3 two way data binding not working?

纵饮孤独 提交于 2019-12-11 08:49:59
问题 please I'm trying to flesh out a registration page for my ionic ongoing project Trying to bind my ([ngModel]) to an object property in my component. Let me just show the code excerpt so you'll understand **Registration.ts** // This is my registration component import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; @IonicPage() @Component({ selector: 'page-registration', templateUrl: 'registration.html', }) export class RegistrationPage

ngModel not working in Angular4

Deadly 提交于 2019-12-08 15:50:20
问题 I am learning Angular 4 from the official site and I came to the part with 2-way data binding through ngModel. However, my app stops working as soon as I add [(ngModel)] to my component template, even though the FormsModule is imported in the module.ts file. The component does not load. I am using Visual Studio Code. This is my app.component.ts import { Component } from '@angular/core'; export class Hero { id: number; name: string; } @Component({ selector: 'app', template: ` <h1>{{ title }}<

Angular2 Quickstart Tutorial Breaking Karma Tests - “Can't bind to 'ngModel' since it isn't a known property of 'input'.”

≯℡__Kan透↙ 提交于 2019-12-06 17:00:49
问题 I am following the official Angular "Hero" Quickstart Tutorial whilst trying to TDD it. https://angular.io/docs/ts/latest/tutorial/toh-pt1.html As soon as I get to the step to replace: <input value="{{hero.name}}" placeholder="name"> with <input [(ngModel)]="hero.name" placeholder="name"> my Karma test runner throws the following error: Error: Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'input'. (" name: ][(ngModel)]="hero.name" placeholder="name"> "):

How to edit the value displayed by [(ngModel)]?

余生颓废 提交于 2019-12-06 03:38:58
I am receiving a value, that I display to the user in a text field. The idea is for him to be able to edit this value, and then send it back. In the case of money, let's say I store the amount in cents, but I want to display it in dollars. Here is an idea of the code I have that display the value I receive : <input type="text" [(ngModel)]="myValue" value="{{myValue}}" /> I tried this without success : <input type="text" [(ngModel)]="myValue/100" value="{{myValue/100}}" /> How can I display that value divided by 100 ? Use the desugared syntax of [()] . <input type=text [(ngModel)]="myValue"> is

Angular2 Quickstart Tutorial Breaking Karma Tests - “Can't bind to 'ngModel' since it isn't a known property of 'input'.”

旧城冷巷雨未停 提交于 2019-12-04 22:34:53
I am following the official Angular "Hero" Quickstart Tutorial whilst trying to TDD it. https://angular.io/docs/ts/latest/tutorial/toh-pt1.html As soon as I get to the step to replace: <input value="{{hero.name}}" placeholder="name"> with <input [(ngModel)]="hero.name" placeholder="name"> my Karma test runner throws the following error: Error: Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'input'. (" name: ][(ngModel)]="hero.name" placeholder="name"> "): AppComponent@6:23 Expected undefined to be defined. However, the application works as expected and I see

Binding ngModel to Dynamic Checkbox List : Angular 2 / Typescript

天涯浪子 提交于 2019-12-04 18:55:28
问题 I'm not sure the proper way to bind and update a model where the checkboxes are dynamically generated. (This is a ASP.NET Core project with Angular 2 initially created using the Yeoman generator) Or a simple checkbox for that matter I have just found out. Below is stripped down code, which has a facility and timeslots. Each facility can have multiple timeslots. The timeslot checkbox list displays fine. The initial data indicates only one timeslot should be checked. But when I load up a