如何在我的项目中使用凉亭包组件 [英] How to use a bower package component into my project
问题描述
我正在使用角度材料设计开发平均堆栈应用程序.我坚持使用'md-datepicker'.我正在设计一个具有出生日期字段的表单,但 md-datepicker 不允许选择年份.我找到了一个凉亭打包机https://github.com/alenaksu/mdPickers",我试图将其添加到我的项目中.
- 我安装了凉亭<块引用>
npm 安装凉亭
- 安装包,<块引用>
bower 安装 mdpackages
在这一步之后,我在我的项目目录中得到了 bower-components.所以我的问题是我应该在哪里链接这个组件.(我在平均堆栈中真的很新).现在我不知道如何在我的项目中使用它.mdpicker-bower 包目录的图片
我知道这个问题有点令人困惑,但如果有人可以帮助我,我会向 teamviwer 敞开心扉.提前致谢.
在实例化根应用程序模块的位置,附加 mdPickers
作为依赖项.比如,
angular.module("app", [mdPicker"]);
然后在控制器中实例化要使用的组件.
angular.module("app").controller("MainCtrl", ['$scope', '$mdpDatePicker', function($scope, $mdpDatePicker) {//用 $mdpDatePicker 做一些事情}]);
您可以在此处找到有关如何使用模块的更完整示例.
I am working on a mean stack application using angular material design. I got stuck on using 'md-datepicker'. I was designing a form which is having an Date of birth field but md-datepicker dont allow to select the year. I found a bower packer "https://github.com/alenaksu/mdPickers" and I was trying to add it into my project.
- I installed the bower
npm install bower
- Install package,
bower install mdpackages
after this steps I got the bower-components in my project directory. So my question is where should i link this components. (I am really new in the mean stack). Now I dont know how to use it in my project. image of the Dir of mdpicker-bower package
I know the question is little bit confusing, but if some one can help me i am will open to teamviwer. Thanks in advance.
Where you instantiate your root application module, append mdPickers
as a dependency. Such as,
angular.module("app", [
"mdPickers"
]);
In your controller, you then instantiate the component you want to use.
angular.module("app").controller("MainCtrl", ['$scope', '$mdpDatePicker', function($scope, $mdpDatePicker) {
// do something with $mdpDatePicker
}]);
You can find more complete examples of how to use the module here.
这篇关于如何在我的项目中使用凉亭包组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!