如果你从头开始一个项目,那就使用DevExtreme Angular 模板。生成的项目带导航菜单以及在响应布局中的几个对应的示例视图。

你可以使用 DevExtreme CLI 生成应用程序:

npx -p devextreme-cli devextreme new angular-app app-name
cd app-name
npm run start

npx 需要 npm v5.2 或更高。如果是之前的版本,要么升级 npm 要么安装全局 DevExtreme CLI 然后运行命令安装以下包:

npm i -g devextreme-cli
devextreme new angular-app app-name

这个程序中已经包含了DataGrid 组件。 下边的指导演示了如何加入其它的DevExtreme 组件,用 Button 组件来举个例子:

在要用到的地方,在NgModule 中导入DevExtreme组件模块。打开src/app/app-routing.module.ts文件,加入如下代码:

app-routing.module.ts

// ...
import { ..., DxButtonModule } from 'devextreme-angular'; @NgModule({
imports: [ ..., DxButtonModule ],
// ...
})
export class AppModule { }

配置DevExtreme 组件标记。添加以下代码到 src/app/pages/home/home.component.html 文件中:

home.component.html

<!-- ... -->
<dx-button
text="Click me"
(onClick)="helloWorld()">
</dx-button>
<!-- ... -->

申明Angular中的DevExtreme回调函数、事件句柄、绑定属性。这个例子中 onClick 事件句柄在 src/app/pages/home/home.component.ts 文件中:

home.component.ts

// ...
export class HomeComponent {
helloWorld() {
alert('Hello world!');
}
}

你点了Home页面,你就可以看到按钮了。

创建DevExtreme应用程序的更多相关文章

  1. ASP.NET MVC - 创建Internet 应用程序

    为了学习 ASP.NET MVC,我们将构建一个 Internet 应用程序. 第 1 部分:创建应用程序. 我们将构建什么 我们将构建一个支持添加.编辑.删除和列出数据库存储信息的 Internet ...

  2. Momentics创建Photon图形程序

    Photon microGui是qnx原生的UI图形工具.Qnx下开发Photon 一般是使用phAB来创建,使用默认的Momentics IDE也可以创建Photon图形程序. 首先需要创建一个c/ ...

  3. SharePoint 2013 创建web应用程序报错"This page can’t be displayed"

    错误描述 This page can’t be displayed •Make sure the web address http://centeradmin is correct. •Look fo ...

  4. [SharePoint 2013 入门教程 2 ] 创建WEB应用程序,网站集,网站

    SharePoint 2013 的 Hello World 由大到小  创建WEB应用程序(老母),网站集(儿子),网站(孙子) 直接确定,其余都默认 填入标题,选好模板.网站集 儿子就有了. 点击页 ...

  5. nodejs+chromium 创建桌面应用程序

    直接用nodejs+javascript+html+css也可以创建桌面应用程序啦,前端开发的同学应该都比较感兴趣. 生成的应用程序自带nodejs环境和chrome浏览器环境. github的ato ...

  6. SharePoint 2013 创建web应用程序报错&quot;This page can’t be displayed&quot;

    错误描写叙述 This page can't be displayed •Make sure the web address http://centeradmin is correct. •Look ...

  7. NET5实践:项目创建-结构概述-程序运行-发布部署

    ASP.NET5实践01:项目创建-结构概述-程序运行-发布部署   1.项目创建 ASP.NET5项目模板有三种: 新建项目: 选择模板: 2.结构概述 References对应配置是project ...

  8. SpringMVC基础入门,创建一个HelloWorld程序

    ref:http://www.admin10000.com/document/6436.html 一.SpringMVC基础入门,创建一个HelloWorld程序 1.首先,导入SpringMVC需要 ...

  9. .net core创建控制台应用程序和mvc程序

    一.创建控制台应用程序 1.查看支持哪些类型:dotnet new --help 2.创建项目(先定位到需要创建的目录) dotnet new console -o ./myconsole 3.查看目 ...

随机推荐

  1. python中进制转换

    使用Python内置函数:bin().oct().int().hex()可实现进制转换. 先看Python官方文档中对这几个内置函数的描述: bin(x)Convert an integer numb ...

  2. 解决GitHub下载资源慢的问题

    打开 C:\Windows\System32\drivers\etc\hosts 添加 # GitHub 解决下载速度慢的问题 192.30.253.113 github.com 151.101.18 ...

  3. UE中正则表达式

    UltraEdit(后简称UE),是我经常使用的文本编辑软件,其功能的强大,令我由衷地爱上了它.每天不用就全身不爽.从最开始的9.0到现在的 12.10a(本人只用到这个版本),UE都是系统重装后必安 ...

  4. C#中构建多线程应用程序[转] ----代码示例

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  5. 使用Django开发简单接口:文章增删改查

    目录 1.一些准备工作 安装django 创建django项目 创建博客应用(app) 2.models.py 3.django admin 登录 创建超级用户 4.修改urls.py 5.新增文章接 ...

  6. 【3】Zookeeper中的角色

    一.Zookeeper角色的分类 领导者(leader) Leader服务器为客户端提供读服务和写服务. 学习者(learner) 跟随者(follower) Follower服务器为客户端提供读服务 ...

  7. 怎么处理U盘无法正常弹出的情况?

    我们都知道U盘和移动硬盘在使用完毕后需要点击“安全删除硬件并弹出”后才能拔出,这样可以避免U盘还在工作时被拔出而造成的故障. 但有时我们点击“安全删除硬件并弹出”时,系统会提示U盘正在工作,没有办法停 ...

  8. In Unix, what is tar, and how do I use it?

      In Unix, the name of the tar command is short for tape archiving, the storing of entire file syste ...

  9. imx6ull增加qt5 qtserialbus库

    meta-qt5库地址:https://code.qt.io/cgit/yocto/meta-qt5.git/   1.在fsl-release-yocto/sources/meta-qt5/reci ...

  10. ios 打包 异常

    1. 问题:Xcode9升级到Xcode10后运行App报错: 2. 原因分析: Xcode10中libstdc++.6.0.9和libstdc++被移除,Frameworks中libstdc++.6 ...