如何将 AngularUI 集成到 AngularJS? [英] How to integrate AngularUI to AngularJS?

查看:34
本文介绍了如何将 AngularUI 集成到 AngularJS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉问了一个愚蠢的问题,大家知道如何开始使用 AngularUI 吗?我已经从 Github 下载了它并阅读了 README 中的说明,但仍然不明白我必须做什么.

Sorry for the silly question, does everyone know how to start using AngularUI? I've downloaded it from Github and read the instruction in README but still don't understand what I have to do.

推荐答案

集成步骤:

  • 包括 jQuery 和 jQuery-ui(最好从 CDN 提供)
  • 包含 angular(如果来自 CDN,最好包含)
  • 包含 angular-ui JS/CSS(目前仅托管在 build 文件夹中的 GitHub 存储库中)
  • 为您计划使用的指令包含任何 jQuery 插件
  • 声明对 angular-ui 模块的依赖(ui.directivesui.filters,具体取决于您计划使用的内容).
  • Include jQuery and jQuery-ui (best served from a CDN)
  • Include angular (it is the best to include if from a CDN)
  • Include angular-ui JS / CSS (currently only hosted in the GitHub repository in the build folder)
  • Include any jQuery plugins for the directives you are planning to use
  • Declare dependencies on the angular-ui modules (ui.directives or ui.filters depending on what you are planning to use).

大多数概述的步骤只是包含 JS/CSS 依赖项.唯一棘手"的部分是声明对 ui.* 模块的依赖,你可以这样做:

Most of the outlined steps are just about including JS/CSS dependencies. The only "tricky" part is to declare dependencies on a ui.* module, you can do it like this:

var myApp = angular.module('myApp',['ui.directives']);

一旦包含了所有依赖项并配置了一个模块,您就可以开始使用了.例如,使用 ui-date 指令就像(注意 ui-date)一样简单:

Once all the dependencies are included and a module configured you are ready to go. For example, using the ui-date directive is as simple as (notice the ui-date):

<input name="dateField" ng-model="date" ui-date>

这里是完整的 jsFiddle,展示了如何使用 ui-date 指令:http://jsfiddle.net/r7UJ2/11/

Here is the complete jsFiddle showing how to use the ui-date directive: http://jsfiddle.net/r7UJ2/11/

您可能还想查看 http://angular-ui.github.com/ 所有指令都有现场示例.

You might also want to have a look at the sources of the http://angular-ui.github.com/ where there are live examples off all the directives.

这篇关于如何将 AngularUI 集成到 AngularJS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆