How to use a bower package component into my proje

2019-07-24 17:09发布

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.

  1. I installed the bower

    npm install bower

  2. 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.

1条回答
\"骚年 ilove
2楼-- · 2019-07-24 17:32

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.

查看更多
登录 后发表回答