Open calebeaires opened 7 years ago
Split.js library add Split
variable globally in the page and ng2-split just use it.
Type 'Split' inside your browser console, if you have 'Split is not defined' error messsage, Split.js is not imported correctly.
Try to add: <script src="node_modules/split.js/split.js"></script>
to your index.html
I have done it. Split is globally on console too.
I have found that if I put import * as Split from "split.js/split"
on your SplitDirective instead of define var Split:any
, the code starts working.
It look like that on this webpack-starter Split global variable is not recognized when the diretive cames from a node_module.
Interesting, I will try using your starter tomorrow.
@bertrandg Have you found an solution? When I use import
from Split global it works, but when I try to make npm run build
the building modules breaks with this error: Cannot find module 'split.js/split'
.
I am using th Angular 2 starter that call globals on vendor.ts
@calebeaires sorry for the delay! No, I've experiment this behavior but didn't find a way to make this works properly on all modules loaders.. I don't understand well how webpack import it.
Currently, I make it works using systemjs and angular-cli (https://github.com/bertrandg/ng2-split/blob/website-src/angular-cli.json). I will investigate more and let you know.
@calebeaires I have a bad and a good news for you. :)
The bad one: I failed to find a way to make ng2-split/Split.js works great with your starter.
And the good one: I coded a new library without other dependencies other that angular using css latest flexbox grid: https://github.com/bertrandg/angular-split
So, to make it works:
npm i angular-split --save
import { AngularSplitModule } from 'angular-split';
<split direction="horizontal">
<split-area size="50">
<p>Lorem ipsum dolor sit amet...</p>
</split-area>
<split-area size="50">
<p>Sed ut perspiciatis unde omnis iste natus erro...</p>
</split-area>
</split>
I tested it with your starter and it works nicely.
It's still WIP, I will add documentation and more options soon but it works the same as this one which I will deprecated.
Hi,
I try to use angular-split with systemjs.
Do you know how to include in system config ?
thx
maybe like this 'angular-split' : 'npm:angular-split/dist/bundles/angular-split.umd.js',
I have tried us this module, but I get the error above.
Angular 2.2 Angular Starter: https://github.com/preboot/angular2-webpack/ Split imported by vendor.ts (
import 'split.js/split';
) with no errors!split.directive.ts?7b3c:108
SplitDirective.build @ split.directive.ts?7b3c:108