问题
I'm going to use Primeng schedule (http://www.primefaces.org/primeng/#/schedule) within a project based on Angular2 webpack starter(https://github.com/AngularClass/angular2-webpack-starter).
Since Primeng schedule depends on fullcalendar.js
which is a jQuery plugin, I try to load fullcalendar
and jQuery through webpack. I follow example at here (https://github.com/cagataycivici/angular2-webpack-starter).
In package.json
, I added settings below to "devDependencies"
"fullcalendar": "^2.7.2",
"jquery": "^2.2.4",
"jquery-ui": "^1.10.5",
and added settings below to vendor.js
import 'script!jquery/dist/jquery.min.js';
import 'script!moment/moment.js';
import 'script!fullcalendar/dist/fullcalendar.js';
But the problem is that the Primeng schedule is not rendered in the webpage, even though the <p-schedule></p-schedule>
tag is actually there. Did I miss something?
回答1:
You need to modify the angular-cli.json, add these to the angular-cli.json file
"styles" : [
"../node_modules/fullcalendar/dist/fullcalendar.min.css",
"../node_modules/primeng/resources/primeng.min.css",
"../node_modules/primeng/resources/themes/omega/theme.css"
],
"scripts" : [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/moment/min/moment.min.js",
"../node_modules/fullcalendar/dist/fullcalendar.js"
],
来源:https://stackoverflow.com/questions/37447536/primeng-schedule-with-angular2-webpack