美文网首页
angular5中使用ngzorro

angular5中使用ngzorro

作者: 梧桐芊雨 | 来源:发表于2019-05-23 20:00 被阅读0次

官方文档:
https://ng.ant.design/docs/getting-started/zh
NG-ZORRO教程:https://github.com/NG-ZORRO/today-ng-steps

1、ngzorr组件安裝

npm install ng-zorro-antd --save

2.引入模块

在根模块中app.module中引入ng-zorro-antd。
这里有两种引入方式,全局引入或单独引入,本例子是全局引入


image.png
单独引入某组件如下
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { NzButtonModule } from 'ng-zorro-antd/button';

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    CommonModule,
    NzButtonModule
  ]
})
export class YourModule { }

3.引入NG-ZORRO样式及svg资源

         "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css",
               "node_modules/ng-zorro-antd/ng-zorro-antd.min.css"
            ],

如下图所示


image.png

ngzorro 组件使用

image.png

import { Component, OnInit} from '@angular/core';

import * as $ from 'jquery'

@Component({

  selector: 'app-root',

 templateUrl: './app.component.html',

  styleUrls: ['./app.component.css']


})

export class AppComponent implements OnInit{

  title = 'testAng';

  file;

  imageUrl:any;

  ngOnInit(){

    console.log('ngOnInit生命周期钩子---001');

  }

    isVisible = false;

    showModal(): void {

    this.isVisible = true;

  }

  handleOk(): void {

    console.log('Button ok clicked!');

    this.isVisible = false;

  }

  handleCancel(): void {

    console.log('Button cancel clicked!');

    this.isVisible = false;

  }

}

效果

点击【弹窗】出现如下


image.png

相关文章

  • angular5中使用ngzorro

    官方文档:https://ng.ant.design/docs/getting-started/zhNG-ZORR...

  • 记录

    ant design 布局 高度100% angular5 jsonp使用 httpclient service ...

  • NgRx/Store 4 + Angular 5使用教程

    本文将会示范如何使用NgRx/Store 4和Angular5。@ngrx/store是基于RxJS的状态管理库,...

  • 在Angular5中使用PrimeNG

    安裝animations 打开你的项目中的.angular-cli.json,在“styles”中加入: 在sty...

  • angular5中使用ng zorro (Ant Design

    在基于angular5的工程中使用ng-zorro的体会 一、ng-zorro介绍 Ant Design 的 An...

  • ionic3升级适配angular5

    昨天angular5和ionic3同时发布更新了,为了用上angular5的新特性,还是有必要踩下坑的,当然踩坑的...

  • angular5中使用canvas简单画板

    angular中使用canvas可以实现一个简单的画板绘制。功能如下:调整笔尖的大小清空画板绘制内容鼠标移动是绘制...

  • angular使用cordova混合开发

    1.场景 现在我使用angular5开发了一个工程。现在业务需求,希望程序能够以app的形式发布到市场上。为了方便...

  • Angular5中状态管理

    前面学习了vue,react 都有状态管理,如vue中的vuex是全局状态管理,在任何组件里都可以引用状态管理中的...

  • angular5 使用 npm 集成 MathJax

    安装 mathjax (建议指定版本,避免升级带来的问题): 安装顺序导入js(严格按照顺序,否则会报 找不到 错...

网友评论

      本文标题:angular5中使用ngzorro

      本文链接:https://www.haomeiwen.com/subject/mlxizqtx.html