How to use javascript libraries in Angular 2 Project -
i have library has function structure this..
$.fn.et_menu = function ( options ) { var settings = $.extend({ type: "default", // can columns, default, mega, combined animtime: 250, openbyclick: true, delaytime: 0 }, options );
which should called
$('.menu.side-menu').et_menu({ type: "default", delaytime: 0 });
any help.. how integrate in angular..
ive included library in index.html file , did
declare var et_menu: any;
in component.ts file..
any rally greatful.
step one
npm install jssha --save [using jssha demo]
it own custom file place in scripts array of angular-cli.json skip step 1
step two
add jssha scripts file in .angular-cli.json file "scripts": [ "../node_modules/jssha/src/sha.js" ]
step three adding var in component used global variable
//using external js modules in angular component declare var jssha: any; // place above component decorator shaobj:any; hash:string; this.shaobj = new jssha("sha-512", "text"); this.shaobj.update("this test"); this.hash = this.shaobj.gethash("hex")
take @ link. has working example , question same typings , without it.
Comments
Post a Comment