Angular5でAngularJS用のモジュールは使えるでしょうか。
Angularを始めたてなので初歩的な質問であることご容赦ください。
[背景]
Angular5を使ってアプリケーションを作っていますが、以下のモジュールを使用することができません。
https://github.com/logbon72/angular-material-datetimepicker
・インポート手順
npm install ng-material-datetimepicker --save
- app.module.tsに下記を追加
typescript
1import { NgMaterialDatetimepickerModule } from 'ng-material-datetimepicker'; ★追加 2@NgModule({ 3 ... 4 imports: [ 5 NgMaterialDatetimepickerModule ★追加 6 ] 7 ... 8})
HTMLテンプレート(xxx.component.html)に以下を追加しました。
html
1<md-input-container flex-gt-md="30"> 2 <label>Timepicker Only</label> 3 <input mdc-datetime-picker date="false" time="true" type="text" id="time" short-time="true" show-todays-date placeholder="Time" 4 min-date="minDate" format="hh:mm a" ng-change="vm.saveChange()" ng-model="time"> 5</md-input-container>
ng serve
したところChromeで以下のエラーを確認
Uncaught ReferenceError: angular is not defined at Object.ngMaterialDatePicker (angular-material-datetimepicker.js:94) at eval (angular-material-datetimepicker.js:1324) at eval (angular-material-datetimepicker.js:1330) at Object../node_modules/ng-material-datetimepicker/js/angular-material-datetimepicker.js (vendor.bundle.js:1396) at __webpack_require__ (inline.bundle.js:55) at eval (app.module.ts:17) at Object../src/app/app.module.ts (main.bundle.js:50) at __webpack_require__ (inline.bundle.js:55) at eval (main.ts:4) at Object../src/main.ts (main.bundle.js:88)
エラーの意味がわからなかったため、
Documentationを読み込んでみると当該モジュールのimport手順がAngularJS時代のもののようでした。
私がAngular5でのimport手順を踏んだためにエラーが発生したのではと考えたため、標題の質問となりました。
あなたの回答
tips
プレビュー