小编3xG*_*Guy的帖子

角7:未捕获的ReferenceError:添加包时未定义全局

我正在构建一个Angular 7应用程序,当我添加一个包npm install dragula --save并将其导入pollyfills.ts文件时,出现此错误:

index.js:2未捕获的ReferenceError:在Object ../ node_modules / crossvent / src 处的webpack_require(bootstrap:83)处的Object ../ node_modules / custom-event / index.js(index.js:2)处未定义全局/crossvent.js(crossvent.js:3)在webpack_require(自举:83)在对象../ node_modules / dragula / dragula.js(dragula.js:4)在webpack_require(自举:83)在模块../ SRC在webpack_require(bootstrap:83)上的/polyfills.ts(polyfills.ts:1)在object.1(polyfills.ts:92)在webpack_require(bootstrap:83)

当我用谷歌搜索时,每个人都说要添加(window as any).global = window;pollyfills.ts我已经做到这一点,但我仍然收到错误。我也准备删除node_modules文件夹,并且npm i我也已经完成了。

我不知道还要在这里做什么。谁能告诉我一些建议或至少解释为什么会这样?

这可能无关紧要,但我也将添加它。在将它们导入之前,还存在一个错误pollyfills.ts

Accordion-group.component.ts:9 Uncaught ReferenceError:未在webpack_require(../src/app/components/accordion/accordion-group.component.ts(accordion-group.component.ts:9)上定义全局变量 bootstrap:83)在Module ../ src / app / components / accordion / accordion.module.ts(accordion.component.ts:10)在webpack_require(bootstrap:83)在Module ../ src / app / …

node.js typescript dragula ng2-dragula angular

8
推荐指数
3
解决办法
1万
查看次数

具有多种内容类型的 ContentChildren

您好,我目前正在构建一个允许多列类型的表。我希望能够像这样使用它:

<my-table [rows]="rows">
     <text-column [someParameters]="here" header="text"></text-column>
     <icon-column [someParameters]="here" header="icon"></icon-column>
</my-table>
Run Code Online (Sandbox Code Playgroud)

text-column并且icon-column是单独的指令。

我目前有一个名为的抽象类column,可以说text-columnicon-column可能看起来像:

   export abstract class Column
   {
       @Input() someParameters:string;
       @Input() header:string;
   }

   export class TextColumnDirective extends Column
   {
      //I do cool stuff here
   }

   export class IconColumnDirective extends Column
   {
      //I do different cool stuff   
   }
Run Code Online (Sandbox Code Playgroud)

我的表可能看起来像:

@Component({
   selector:'my-table',
   template: `
        <table>
            <thead>
                <tr>
                   <th *ngFor="let column of columns">{{column.header}}</th>
                </tr>
            </thead>
        </table>
   `
})
export class MyTableComponent
{
    @ContentChildren(Column) columns:QueryList<any>;

    //I …
Run Code Online (Sandbox Code Playgroud)

angular

7
推荐指数
2
解决办法
3397
查看次数

反应式表单无法与 ControlValueAccessor 一起使用

我已经构建了一个名为 的控件TextBox,为了简单起见,我将只在此发布该控件的相关部分。

    @Component({
      selector: 'app-textbox',
      template:
      `
        <input [(ngModel)]="value" [disabled]="disabled" />
      `,
      styleUrls: ['./textbox.component.css']
    })
    export class TextboxComponent implements OnInit, ControlValueAccessor {
    
      constructor() { }
      writeValue(obj: any): void {
        this._value = obj;
      }
      registerOnChange(fn: any): void {
        this.onChange = fn;
      }
      registerOnTouched(fn: any): void {
        this.onTouch = fn;
      }
      setDisabledState?(isDisabled: boolean): void {
        this.disabled = isDisabled;
      }
    
      disabled = false;
    
      onChange:()=>{}
      onTouch:()=>{};
    
      private _value:string;
      public get value():string {
        return this._value
      } 
      public set value(value:string){
        this._value = value;
      } …
Run Code Online (Sandbox Code Playgroud)

typescript angular angular-reactive-forms angular-forms

5
推荐指数
1
解决办法
3579
查看次数

reader.GetDateTime(null)

我正在开发一个将从存储过程读取并放入工作表的应用程序。我的问题是,当我遇到null时,代码中未对其进行处理。

               while (reader.Read())
               {

                   ws.Cells[i, 1] = reader.GetString(0);
                   ws.Cells[i, 2] = reader.GetString(1);
                   ws.Cells[i, 3] = reader.GetString(2);
                   ws.Cells[i, 4] = reader.GetString(3);
                   ws.Cells[i, 5] = reader.GetString(4);
                   ws.Cells[i, 6] = reader.GetString(5);
                   ws.Cells[i, 7] = reader.GetDecimal(6);
                   ws.Cells[i, 8] = reader.GetDateTime(7);
                   ws.Cells[i, 9] = reader.GetDecimal(8);
                   ws.Cells[i, 10] = reader.GetDecimal(9);
                   ws.Cells[i, 11] = reader.GetDecimal(10);
                   ws.Cells[i, 12] = reader.GetDecimal(11);
                   ws.Cells[i, 13] = reader.GetDateTime(12);
                   ws.Cells[i, 13] = reader.GetDateTime(13);
                   i++;
               }
               reader.Close();
Run Code Online (Sandbox Code Playgroud)

如果有人可以解释如何处理,以便我们只将单元格留空;谢谢!!

c# sql

3
推荐指数
2
解决办法
3160
查看次数

Linq拆分组(如果缺少号码)

这完全让我难过。

假设我们有一个整数列表

var list = new List {
   1,
   2,
   3,
   5,
   6,
   7,
   9,
   10    
};
Run Code Online (Sandbox Code Playgroud)

我如何将其分组为1-3,5-7,9-10,在缺少下一个整数的地方进行分组?

c# linq

3
推荐指数
1
解决办法
84
查看次数

如何关闭整个数据库的区分大小写

我创建了一个包含许多脚本和许多 sproc 的数据库,在这个数据库中,我们没有注意担心区分大小写,因为它在我的本地开发机器上是关闭的。

说了这么多,我想弄清楚如何使以下 2 个语句返回相同的结果。

SELECT * FROM companies
SELECT * FROM Companies
Run Code Online (Sandbox Code Playgroud)

目前小写的不返回任何内容并表示模式中没有该表。

mysql mariadb

0
推荐指数
1
解决办法
8395
查看次数

将"\\ server\printer"更改为"服务器上的打印机:"

我有一个字符串"\\server\printer",我需要将其更改为""服务器上的打印机:"

请注意"服务器和打印机的长度可能不同.

c# string

-3
推荐指数
1
解决办法
129
查看次数