使用DatePicker无法加载资源错误

时间:2018-08-25 04:11:56

标签: angular angular4-forms

我正在尝试使用日期选择器,但出现错误:

  

:3000 / app / common / basic.html:1无法加载资源:服务器   响应状态为404(未找到)

     

zone.js:665未处理的承诺拒绝:无法加载   app / common / basic.html;区域:任务:Promise.then;值:   无法加载未定义的app / common / basic.html

datepicker.ts

 import { Component } from '@angular/core';      
 @Component({
  selector: 'demo-datepicker-basic',
  templateUrl: './basic.html'
})
export class DemoDatepickerBasicComponent {}

datepicker.ts

<div class="row">
    <div class="col-xs-12 col-12 col-md-4 form-group">
      <input type="text"
             placeholder="Datepicker"
             class="form-control"
             bsDatepicker>
    </div>
    <div class="col-xs-12 col-12 col-md-4 form-group">
      <input type="text"
             placeholder="Daterangepicker"
             class="form-control"
             bsDaterangepicker>
    </div>
  </div>

app.module.ts

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent }  from './app.component';
import{DemoDatepickerBasicComponent} from './common/datepicker'

@NgModule({
  imports:      [ BrowserModule],
  declarations: [ AppComponent,DemoDatepickerBasicComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

app.component.ts

import { Component } from '@angular/core';
import{DemoDatepickerBasicComponent} from './common/datepicker'
@Component({
  selector: 'my-app',
  template: `<h1>Hello {{name}}</h1><demo-datepicker-basic></demo-datepicker-basic>`,
})
export class AppComponent  { name = 'Angular'; }

0 个答案:

没有答案