前端学习(2328):angular之模板
生活随笔
收集整理的這篇文章主要介紹了
前端学习(2328):angular之模板
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
test2.component.html
<p>test2 works!</p> <a href="{{url}}">百度</a> <a [href]="url">百度2</a>test1.component.spec.ts
import { ComponentFixture, TestBed } from '@angular/core/testing';import { Test2Component } from './test2.component';describe('Test2Component', () => {let component: Test2Component;let fixture: ComponentFixture<Test2Component>;beforeEach(async () => {await TestBed.configureTestingModule({declarations: [ Test2Component ]}).compileComponents();});beforeEach(() => {fixture = TestBed.createComponent(Test2Component);component = fixture.componentInstance;fixture.detectChanges();});it('should create', () => {expect(component).toBeTruthy();}); });test1.component.ts
import { Component, OnInit } from '@angular/core';@Component({selector: 'app-test2',templateUrl: './test2.component.html',styleUrls: ['./test2.component.css'] }) export class Test2Component implements OnInit {constructor() { }ngOnInit(): void {this.url="http://www.baidu.com"}}運行結(jié)果
總結(jié)
以上是生活随笔為你收集整理的前端学习(2328):angular之模板的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 前端学习(2248)git是怎么运作的
- 下一篇: 会计从业【13】