view-info

angular7.0+ ViewInfo

Usage no npm install needed!

<script type="module">
  import viewInfo from 'https://cdn.skypack.dev/view-info';
</script>

README

view-info

angular7+以上的版本可以使用

1、开始使用

安装

npm i view-info

使用

ViewInfoModule需添加到使用的module的文件中。此处以AppModule为例:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { ViewInfoModule } from 'view-info';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    ViewInfoModule
    AppRoutingModule,
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
    <c-view-info [viewInfoTemplate]="name"></c-view-info>

    <ng-template #name>
      <div>我是view-info</div>
    </ng-template>
  `,
  style: [`
    div {
      height: 1000px;
    }
  `]
})
export class AppComponent {}