Angular PrimeNG边框风格

Angular PrimeNG边框风格

Angular PrimeNG是一个开源框架,拥有丰富的原生Angular UI组件,可用于出色的造型,这个框架用于制作响应式网站,非常容易。在这篇文章中,我们将了解如何在Angular PrimeNG中使用划分器边框样式。我们还将学习属性和样式,以及在代码中使用的语法。

分割器组件是用来做一个使用分割器分割内容的组件。

Angular PrimeNG Divider边框风格属性:

  • type。它是边框样式的类型。它有3个可能的值,即虚线、虚线实线。它是字符串数据类型,默认值为实心。

语法:

<p-divider 
    type="dashed">
</p-divider>

创建Angular应用程序和模块安装。

第1步:使用以下命令创建一个Angular应用程序。

ng new appname

第2步:创建你的项目文件夹即appname后,使用以下命令移动到它。

cd appname

步骤3:在你给定的目录中安装PrimeNG。

npm install primeng --save
npm install primeicons --save

项目结构:它将看起来像如下。

Angular PrimeNG边框风格

运行以下命令以查看输出。

ng serve --open

示例1:这是说明使用Angular PrimeNG Divider Border Style的基本示例代码。

<h2 style="color: green">GeeksforGeeks</h2>
<h5>PrimeNG Divider Border Styled</h5>
  
<div>
      Angular PrimeNG is a framework 
      used with angular to create components
      with great styling and this framework is 
      very easy to use and is used to
      make responsive websites.
</div>
  
<p-divider type="dashed"></p-divider>
  
<div>
    Angular PrimeNG is a framework 
    used with angular to create components
    with great styling and this framework is 
    very easy to use and is used to
    make responsive websites.
</div>
import { Component } from '@angular/core';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss'],
})
  
export class AppComponent {}
import { NgModule } from "@angular/core";
import { BrowserModule } from 
    "@angular/platform-browser";
import { BrowserAnimationsModule } from 
    "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { DividerModule } from "primeng/divider";
import { ButtonModule } from "primeng/button";
  
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    DividerModule,
    ButtonModule
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}

输出:

Angular PrimeNG边框风格

示例2:下面是另一个示例代码,说明了Angular PrimeNG Divider Border Style的使用,它使用了一个点状分隔线和一些文本。

<h2 style="color: green">GeeksforGeeks</h2>
<h5>PrimeNG Divider Border Styled</h5>
  
<div>
    Angular PrimeNG is a framework 
    used with angular to create components
    with great styling and this framework is 
    very easy to use and is used to
    make responsive websites.
</div>
  
<p-divider type="dotted">
  <b>GfG</b>
</p-divider>
  
<div>
    Angular PrimeNG is a framework 
    used with angular to create components
    with great styling and this framework is 
    very easy to use and is used to
    make responsive websites.
</div>
import { Component } from '@angular/core';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss'],
})
  
export class AppComponent {}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from 
    '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { DividerModule } from 'primeng/divider';
import { ButtonModule } from 'primeng/button';
  
@NgModule({
imports: [
    BrowserModule,
    BrowserAnimationsModule,
    DividerModule,
    ButtonModule,
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
  
export class AppModule {}

输出:

Angular PrimeNG边框风格

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程