app / components / rocket / rocket-search.ts(63,10):错误TS2339:属性' intercomSettings'在类型' Window'上不存在

时间:2018-01-12 09:44:47

标签: javascript html angular typescript intercom

  • 我正在尝试在我的应用中使用对讲机。
  • 当我在index.html
  • 中放入脚本标记时,它的工作正常
  • 但是当我尝试在.ts文件中使用时,我遇到了错误。 app / components / rocket / rocket-search.ts(63,10):错误TS2339:属性' intercomSettings'类型' Window'
  • 上不存在
  • 你能告诉我如何解决它。
  • 在下面提供我的代码

无法使用代码

// Example program
#include <iostream>
#include <vector>

int main()
{
    struct struct_1
    {
        int variable_1;
        int variable_2;
    };

    std::vector<struct_1> vector_a;

    vector_a.push_back(struct_1());
    vector_a.push_back(struct_1());
    vector_a.push_back(struct_1());

    vector_a.resize(2);


    vector_a[0].variable_1 = 21;
    vector_a[0].variable_2 = 34;

    vector_a[1].variable_1 = 111;
    vector_a[1].variable_2 = 764;

    vector_a[2].variable_1 = 5656;
    vector_a[2].variable_2 = 5666764;

    std::cout << "size    " << vector_a.size() << std::endl;
}

index.html中的工作代码

import { Component, ElementRef, Input, Output, EventEmitter, Inject, OnInit, ViewChild } from '@angular/core';
import { KendoGridComponent } from '../grid/grid.component'
import { Router } from '@angular/router';
import { sportsService } from '../../services/sports.service';


@Component({
    selector: 'rocketSearch',
    templateUrl: "./app/components/rocket/rocket-search.html",
})

export class rocketSearch {
    /* Localization variables */

    @Output() rocketSearchEmitter: EventEmitter<any> = new EventEmitter<any>();

    private dataSourceVal;
    private MainGrid;
    private grid;
    private titles;
    public rocketRef;

    constructor( public elementRef: ElementRef, public router: Router, public sportsService: sportsService) {
    }
    private kendocommand = {
        edit: { createAt: "bottom" },
        autoBind: false,
        excelFileName: {
            fileName: "",
            allPages: true
        }
    }

    ngOnInit() {

        let that = this;
        let attributes = this.sportsService.getSeesionStorageValue();
        // if (attributes) {
        //  this.userId = attributes.user_attributes.SSO[0];
        // }

        //app/components/rocket/rocket-search.ts(63,10): error TS2339: Property 'intercomSettings' does not exist on type 'Window'.


        window.intercomSettings = {
            app_id: 'irgooiqb',
            name: "Jane Doe", // Full name
            email: "customer@example.com", // Email address
            created_at: 1312182000 // Signup date as a Unix timestamp
        };
        //console.log(.log(this.userId);
    }

}

0 个答案:

没有答案