사용자 도구

사이트 도구


angular:style-binding

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
angular:style-binding [2019/01/14 08:45] – 만듦 taekguangular:style-binding [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1
줄 1: 줄 1:
 ===== Style Binding ===== ===== Style Binding =====
  
 +<code javascript>
 +import { Component, OnInit } from '@angular/core';
 +
 +@Component({
 +  selector: 'app-test-sb',
 +  template: `
 +  <h2>
 +    Welcome {{ name }}
 +  </h2>
 +  <h2 [style.color]="hasError ? 'red' : 'green'">Style Binding</h2>
 +  <h2 [style.color]="highlightColor">Style Binding</h2>
 +
 +  <h2 [ngStyle]="titleStyle">Style Binding</h2>
 +  `,
 +  styleUrls: ['./test-sb.component.css']
 +})
 +export class TestSbComponent implements OnInit {
 +
 +  public name = "Codevolution";
 +
 +  public successClass = "text-success";
 +  public hasError = false;
 +  public isSpecial = true;
 +  public highlightColor = "orange";
 +
 +  public titleStyle = {
 +    color: "blue",
 +    fontStyle: "italic"
 +  }
 +  constructor() { }
 +
 +  ngOnInit() {
 +  }
 +
 +}
 +</code>
angular/style-binding.1547455539.txt.gz · 마지막으로 수정됨: 2025/04/15 10:05 (바깥 편집)