angular

Angular 6 custom directive not updating after value change

…衆ロ難τιáo~ 提交于 2021-02-10 18:54:25
问题 I want to make a dynamic menu, the menu itself has css class in which if i check a checkbox the menu has to change position from left to right. Right now the directive works, but only once, when the program loads, if i try to change the check the checkbox within the program nothing happens. the html: <div class="wrapper"> <div class="app-menu" adjustSide side="{{position}}"> <router-outlet></router-outlet> </div> </div> I tried with (side)="position" , [side]="position" and [(side)]="position

Angular 6 custom directive not updating after value change

我的梦境 提交于 2021-02-10 18:51:16
问题 I want to make a dynamic menu, the menu itself has css class in which if i check a checkbox the menu has to change position from left to right. Right now the directive works, but only once, when the program loads, if i try to change the check the checkbox within the program nothing happens. the html: <div class="wrapper"> <div class="app-menu" adjustSide side="{{position}}"> <router-outlet></router-outlet> </div> </div> I tried with (side)="position" , [side]="position" and [(side)]="position

Passing `ngModelOptions` through from a custom component to a contained native element

偶尔善良 提交于 2021-02-10 18:47:37
问题 I have a custom component (Angular 6) called ppo-currency-field with the following template: <span class="display" tabindex="-1">{{formattedValue()}}</span> <input #input class="input" type="number" [name]="name" [tabindex]="tabindex" [readonly]="!!readonly || readonly===''" [disabled]="!!disabled || disabled===''" [ngModel]="value" (ngModelChange)="writeValue($event)" [ngModelOptions]="ngModelOptions"> My component code contains the line: @Input() ngModelOptions: Object; I'm using my

FormControl validator always invalid

≡放荡痞女 提交于 2021-02-10 18:43:53
问题 Following my previous question, I'm trying to create a custom validator that allow the users to type only specific values in an input of text. app.component.ts: export class AppComponent implements OnInit { myForm: FormGroup; allowedValuesArray = ['Foo', 'Boo']; ngOnInit() { this.myForm = new FormGroup({ 'foo': new FormControl(null, [this.allowedValues.bind(this)]) }); } allowedValues(control: FormControl): {[s: string]: boolean} { if (this.allowedValuesArray.indexOf(control.value)) { return

Angular Material Datepicker design issue when opening calendar

感情迁移 提交于 2021-02-10 18:34:30
问题 I am having an issue when using Angular Material Datepicker and I can't seem to find the root problem of it. I couldn't think of a way to word this question. Whenever I open the calendar and I'm selecting the day, the overlay is too large and is past the boundaries of the box. Hopefully, this attached image can help: I have the following imports in the module the component is in: import { MatDatepickerModule, MatNativeDateModule, MatFormFieldModule, MatInputModule, MatOptionModule } from '

How to handle hashed assets with sprite.svg in Angular 10

老子叫甜甜 提交于 2021-02-10 18:21:55
问题 Recently, we updated our Angular application from version 8 to version 10 , where we add fixes to assets folder for having relative path and it work perfectly fine for all images except sprite icons. We having svg-fragment-identifiers, where hash code is used as identifiers for specific to SVG icon from SPRITE file. In Angular 8 - background: url(sprite.60bf8dc8eb06ec7972fe.svg#search) no-repeat In Angular 10 - background: url(sprite.60bf8dc8eb06ec7972fe.svg) no-repeat Problem - After hash

I need to display the selected date in header in fullcalendar

假如想象 提交于 2021-02-10 18:21:41
问题 Is there any way way by which the selected date can be display on the header as user clicks on date in fullcalendar angular. headerToolbar: { left: '', center: 'title', right: 'prev title next' }, As mentioned in the above short code on the centre of header toolbar instead of title i nedd to display the date selected by the user as user clicks on the dates dynamically. 来源: https://stackoverflow.com/questions/65839175/i-need-to-display-the-selected-date-in-header-in-fullcalendar

How to handle hashed assets with sprite.svg in Angular 10

纵然是瞬间 提交于 2021-02-10 18:19:20
问题 Recently, we updated our Angular application from version 8 to version 10 , where we add fixes to assets folder for having relative path and it work perfectly fine for all images except sprite icons. We having svg-fragment-identifiers, where hash code is used as identifiers for specific to SVG icon from SPRITE file. In Angular 8 - background: url(sprite.60bf8dc8eb06ec7972fe.svg#search) no-repeat In Angular 10 - background: url(sprite.60bf8dc8eb06ec7972fe.svg) no-repeat Problem - After hash

Angular , creating new project fail

心已入冬 提交于 2021-02-10 18:06:50
问题 I am new to Angular. Successfully installed Angular by Cls, but when i create project by typing "ng new projectName". It fails. gives me this $ ng new p1 CREATE p1/angular.json (3512 bytes) CREATE p1/package.json (1306 bytes) CREATE p1/README.md (1019 bytes) CREATE p1/tsconfig.json (384 bytes) CREATE p1/tslint.json (2805 bytes) CREATE p1/.editorconfig (245 bytes) CREATE p1/.gitignore (503 bytes) CREATE p1/src/environments/environment.prod.ts (51 bytes) CREATE p1/src/environments/environment

Getting “inject() must be called from an injection context” after upgrading to Angular 11

半世苍凉 提交于 2021-02-10 18:01:25
问题 After upgrading to Angular 11, I am not able to ng serve my web application anymore. I am generating the client using Spring Doc and the latest OpenAPI generator gradle-plutin (5.0.0). The problem appears to be related to my (generated) REST-client. Opening https://localhost:4200 will write the following into the console: main.ts:12 Error: inject() must be called from an injection context at injectInjectorOnly (core.js:4901) [angular] at Module.ɵɵinject (core.js:4911) [angular] at Object