在 nativescript 中看不到 console.log() 中的值
Can't see values in console.log() in nativescript
我有一个包含数组的 js 文件! js文件是这样的
export const appointments = [
{
"taskID": 9018929,
"resource_ID": 1,
"title": "KNDL Thatcham",
"description": "<Non-Selected>\r\n10:00 - 18:00",
"startTime": "2018-12-28T00:00:00",
"endTime": "2018-12-28T23:59:00",
"statusColour": "#DFDFDF",
"clientColour": "#FFFDD7"
}]
我已经在 service.ts 中导入了这个 js 文件。而这个 appointments.js 没有显示在 console.log.
import { Injectable } from '@angular/core';
import { appointments } from '../appointments';
import { Color } from "tns-core-modules/color";
// >> angular-calendar-require
import { CalendarEvent } from 'nativescript-ui-calendar';
@Injectable({
providedIn: 'root'
})
export class CalendarService {
constructor() {
//var a="test test etsdhsakdsakd dsddssdsd";
console.log(appointments);
}
这是我导入 service.ts
的组件
import { Component, OnInit } from '@angular/core';
import { CalendarService } from "./service/calendar.service";
import { RadCalendar, CalendarEvent, CalendarSelectionEventData } from "nativescript-ui-calendar";
@Component({
selector: 'ns-calendar',
templateUrl: './calendar.component.html',
styleUrls: ['./calendar.component.css'],
moduleId: module.id,
providers: [CalendarService]
})
export class CalendarComponent implements OnInit {
}
您需要在构造函数中添加一个类型为 CalendarService 的私有 calendarService 参数。
当Angular 创建 CalendarComponent 时,Dependency Injection 系统将 calendarService 参数设置为 CalendarService 的单例实例。
export class CalendarComponent 实现 OnInit {
构造函数(日历服务:日历服务){}
}
我有一个包含数组的 js 文件! js文件是这样的
export const appointments = [
{
"taskID": 9018929,
"resource_ID": 1,
"title": "KNDL Thatcham",
"description": "<Non-Selected>\r\n10:00 - 18:00",
"startTime": "2018-12-28T00:00:00",
"endTime": "2018-12-28T23:59:00",
"statusColour": "#DFDFDF",
"clientColour": "#FFFDD7"
}]
我已经在 service.ts 中导入了这个 js 文件。而这个 appointments.js 没有显示在 console.log.
import { Injectable } from '@angular/core';
import { appointments } from '../appointments';
import { Color } from "tns-core-modules/color";
// >> angular-calendar-require
import { CalendarEvent } from 'nativescript-ui-calendar';
@Injectable({
providedIn: 'root'
})
export class CalendarService {
constructor() {
//var a="test test etsdhsakdsakd dsddssdsd";
console.log(appointments);
}
这是我导入 service.ts
的组件import { Component, OnInit } from '@angular/core';
import { CalendarService } from "./service/calendar.service";
import { RadCalendar, CalendarEvent, CalendarSelectionEventData } from "nativescript-ui-calendar";
@Component({
selector: 'ns-calendar',
templateUrl: './calendar.component.html',
styleUrls: ['./calendar.component.css'],
moduleId: module.id,
providers: [CalendarService]
})
export class CalendarComponent implements OnInit {
}
您需要在构造函数中添加一个类型为 CalendarService 的私有 calendarService 参数。
当Angular 创建 CalendarComponent 时,Dependency Injection 系统将 calendarService 参数设置为 CalendarService 的单例实例。
export class CalendarComponent 实现 OnInit { 构造函数(日历服务:日历服务){}
}