一、项目根目录下
npm install jquery --save
二、项目根目录下
npm install bootstrap --save
三、往项目中加入bootstrap.css,在angular-cli.json中 apps -> styles 数组里面添加字符串
"../node_modules/bootstrap/dist/css/bootstrap.css"
往项目中加入jquery.js、bootstrap.js,在angular-cli.json中 apps -> scripts 数组里面添加字符串
"../node_modules/jquery/dist/jquery.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
四、安装 typescript<->jquery、typescript<->bootstrap 两个类型描述文件,是的typescript认识jquery和bootstrap的代码
npm install @types/jquery --save-dev
npm install @types/bootstrap --save-dev
五、使用angular命令行工具来生成 6个组件
ng g component navbar
ng g component footer
ng g component search
ng g component carousel
ng g component product
ng g component stars
六、查看typescript版本是否太低,进入node_modules/typescript/package.json 查看版本号,否则node_modules/@types/xxx/index.d.ts中会报错,项目的typescript版本要比index.d.ts中的typescript版本高