After installing foundation using jspm install foundation, and importing jquery alongside it
I encountered an issue where importing jquery with import $ as 'jquery'
resulted in the error message "jquery_1.default is not a function." However, importing jquery with import * as $ from 'jquery'
worked as expected.
To initialize foundations javascript components, I utilized $(document).foundation();
. Below is my main.ts file:
import 'foundation'
import $ from 'jquery';
import {Aurelia} from 'aurelia-framework';
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(a => a.setRoot())
.then(a => {
// Initialize framework
$(document).foundation();
});
}
The rest of the code consists of standard navigation to a basic page featuring a foundation navbar with dropdown list elements.
Note: Despite jquery being listed as a dependency, I had to explicitly install it.
Initially, when I overrode foundation 6, everything appeared to be functioning correctly. However, upon further inspection, I discovered that bootstrap had placed jquery in github:components, eliminating the need for separate installation. This oversight initially masked the issue.
To replicate this problem, simply use the aurelia skeleton and add a page containing a foundation control, including the $(document).foundation() call as shown above.