npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-zorro-formly3

v6.1.4

Published

这是[ngx-formly](https://github.com/ngx-formly/ngx-formly)的[ng-zorro](https://ng.ant.design/docs/introduce/zh)主题UI。

Downloads

15

Readme

Ngx-Ng-Zorro-Formly

这是ngx-formlyng-zorro主题UI。

配置模板 ngx-ng-zorro-formly

使用方法

支持Angular 13 及以上版本

  1. 安装ng-zorro

    ng add ng-zorro-antd
  2. 安装 ngx-formly

    yarn add @ngx-formly/core
  3. 安装 ng-zorro-formly,安装富文本库quill

     yarn add ng-zorro-formly quill
  4. 配置初始化 在项目的 app.module.ts 导入 FormlyNgZorroModule;

    import { FormlyModule } from '@ngx-formly/core';
    import { NzFormModule } from 'ng-zorro-antd/form';
    import { FormlyNgZorroModule } from 'ngx-formly-ng-zorro';
    
    function requiredValidationMessage(err: any, field: any) {
      return `${field.templateOptions.label} 为必填项`;
    }
    
    @NgModule({
        imports: [
            ...
            NzFormModule,
            FormlyModule.forRoot({ 
              extras: { lazyRender: true },
              validationMessages: [
                {name: 'required', message: requiredValidationMessage}
              ]
            }),
            FormlyNgZorroModule,
        ],
    })
    export class AppModule { }
  5. 引入组件 在需要构建表单的地方引入模板组件。form、model、options不传,将会使用默认,如果要用的话可以通过组件实例拿到。

```
<formly-form-template 
  #formlyFormTemplate
  [configs]="configs"
></formly-form-template>
```
  1. 传入配置项 使用ngx-ng-zorro-formly提供的组件配置模板 配置configs。
```
import { Component, OnInit } from '@angular/core';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { FormlyFormTemplateComponent } from 'ng-zorro-formly';

@Component({
  selector: 'app-root',
  template: `
    <formly-form-template 
      #formlyFormTemplate
      [configs]="configs"
    ></formly-form-template>
  `,
  styleUrls: ['./app.component.less']
})
export class AppComponent implements OnInit {
  @ViewChild('formlyFormTemplate') formlyFormTemplate: FormlyFormTemplateComponent;
  configs: FormlyFieldConfig[] = []

  ngOnInit(): void {
    this.configs = [
    ...控件配置
    ]

  }

  submit() {
    const valid = this.formlyFormTemplate.validForm();
    if (valid) {
      const model = this.formlyFormTemplate.submit();
      console.log('model >>:', model);
    }
  }
}
```