Kayıtlar

angular etiketine sahip yayınlar gösteriliyor

Angular Material Design Mat-Select Unit Test

const debugElement = fixture.debugElement; const matSelect = debugElement.query(By.css('.mat-select-trigger')).nativeElement; matSelect.click(); fixture.detechChanges(); const matOption = debugElement.query(By.css('.mat-option'))[0].nativeElement; matOption.click(); fixture.detechChanges(); fixture.whenStable().then( () => {    const inputElement: HTMLElement = debugElement.query(By.css('.ask-input')).nativeElement;    expect(inputElement.innerHTML.length).toBeGreaterThan(0); });

Deploy and config NGINX on Angular 7 + Nginx Docker

Create and run docker image docker run --name app-nginx -p 9595:80 -v /media/storage/angular7nginx-app/:/usr/share/nginx/html:ro -d nginx Go to docker image docker exec -ti app-nginx /bin/bash vim /etc/nginx/nginx.conf Add these line of code inside the http Restart docker container Check docker logs docker logs app-nginx app-nginx is application name server {     listen 80;     listen [::]:80;     server_name http://ip;     root /usr/share/nginx/html;     index index.html index.htm;     location / {         try_files $uri $uri/ /index.html; # This will allow you to refresh page in your angular app. Which will not give error 404.     } } usefull commands on docker: docker commit app-nginx nginx:latest  --> create a new docker with latest tag docker logs app-nginx -f                       ...

Important Parts in Angular 6 - will be updated.

Resim
OnDestroy() Unsubscribe from Observables and DOM events. Stop interval timers. Unregister all callbacks that this directive registered with global or application services. You risk memory leaks if you neglect to do so. EventEmitter Here are the pertinent excerpts from that  HeroDetailComponent : src/app/hero-detail.component.ts (template) template : ` <div> <img src="{{heroImageUrl}}"> <span [style.text-decoration]="lineThrough"> {{prefix}} {{hero?.name}} </span> <button (click)="delete()"> Delete </button> </div>` src/app/hero-detail.component.ts (deleteRequest) // This component makes a request but it can't actually delete a hero. deleteRequest = new EventEmitter < Hero >(); delete () { this . deleteRequest . emit ( this . hero ); } The component defines a  deleteRequest  property that returns an  EventEmitter . When the user clicks  delete , the component invokes t...

Angular 6 If else statement

< div * ngIf = "condition statement;else other_content" > content here ... </ div > < ng - template # other_content > other content here ...</ ng - template > you can also use  then else  : < div * ngIf = "condition statement;then content else other_content" > here is ignored </ div > < ng - template # content > content here ...</ ng - template > < ng - template # other_content > other content here ...</ ng - template > or  then  alone : < div * ngIf = "condition statement;then content" ></ div > < ng - template # content > content here ...</ ng - template >