-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import 3rd Party Library: Pikaday Datepicker with no dependencies #1342
Comments
you could just import the type like you do with 'Component' and than use something like -> import { Pikaday } from 'picaday' /and then maybe in the constructor of the class add your references. above is not tested by me. and i guess you should add something like input binding or something for the element you bind to the 'field'. Hope this helps you a bit |
did the above solution work? |
The above solution did not work. The issue is that the cli is not staying up to date with typings. In the readme, it says it is using typings v1.0.0 or greater. But the package.json shows it's using typings v0.8.1. There was a pretty important change between these two versions: v1.0.0 uses the keyword |
You could try the 'tsd' instead of 'typings' ? Met vriendelijke groet, Mark Struik
|
What I did is, I added the pikaday module in angular-cli.build file, system-config file and gave the path of the module in index.html file (explicitly including the css paths in the html file). Once you have these things in place, you can globally use the pikaday module. |
@saransh94 Do you have a gist or example repo? Did you actually get it to work? I would like to see it. |
@bpyle0092 The project I'm working on is confidential. But I can definitely assist you on your project, just do the above steps and let me know. I'll take a look at it and will modify it if needed. |
I really appreciate the help. But part of the issue I'm having is how exactly to add the modules to certain files. Could you be more specific? For example: "In angular-cli.build file in And then to use globally do I just |
Closed as issue was made obsolete by #1455. You should be able to just import it on the next release, and get typings out of |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OSX El Capitan
angular-cli: 1.0.0-beta.8
node: 6.2.2
os: darwin x64
Pikaday is a simple datepicker that uses only JavaScript and CSS. No other dependencies are necessary. The import process seems nearly identical to the tutorial for Underscore.
Here is my repo
I created my project using the angular-cli and added a single component called PikadayComponent then made sure it was connected properly to app.component.
I followed the steps from the underscore tutorial for both pikaday and underscore:
1. Install pikaday via npm
npm install pikaday --save
npm install underscore --save
1a. Install typings for library
typings install dt~pikaday --global --save
typings install dt~underscore --global --save
2. Add pikaday to angular-cli-build.js file to vendorNpmFiles array
3. Configure SystemJS mappings to know where to look for pikaday
4. Importing and using underscore library in your project source files
When looking at underscore's
index.d.ts
file, the very bottom exports_
. So I figured the exported variable is what I should use in thedeclare var
statement. The export at the bottom of pikaday'sindex.d.ts
file wasPikaday
, so that's what I used:declare var Pikaday;
Problem
When I
ng serve
the project I get the following error report:Nothing is printed in the console.
Another Question
For pikaday, It seems that I must declare it with the
field
property set to an input element. See Here.Given that underscore is declared like
declare var _;
how would I includefield
fordeclare var Pikaday
?Any help or insight would be great.
The text was updated successfully, but these errors were encountered: