小编Yaz*_*rez的帖子

Angular 9 Ivy - 通用类型“??FactoryDe​​f”需要 2 个类型参数

看起来 Angular Ivy 还没有准备好。我正在尝试使用 ivy 构建我的项目,这是 Angular 9 的主要思想。许多库与此功能不兼容,其中一个库是@angular/flex-layout. Material 和 service-worker 也有同样的问题。

使用ng build --prod --aot -c=production脚本构建我的项目后,我得到:

                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/media-trigger/media-trigger.d.ts:71:18 - error TS2314: Generic type '??FactoryDef' requires 2 type argument(s).

71     static ?fac: ?ngcc0.??FactoryDef<MediaTrigger>;
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/extended/typings/show-hide/show-hide.d.ts:18:18 - error TS2314: Generic type '??FactoryDef' requires 2 type argument(s).

18     static ?fac: ?ngcc0.??FactoryDef<ShowHideStyleBuilder>;
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/extended/typings/show-hide/show-hide.d.ts:49:18 - error TS2314: Generic type '??FactoryDef' requires 2 type argument(s).

49     static ?fac: ?ngcc0.??FactoryDef<ShowHideDirective>;
Run Code Online (Sandbox Code Playgroud)

错误比我上面写的要长,我花时间仔细搜索了这个问题,除了禁用常春藤,这不是一个好的选择。

ivy angular angular9

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

无法解析MatDialogRef angular 4的所有参数

我正在研究Angular 4,我正在尝试设置材料包,在这里我试图尝试对话,但它不起作用可能是因为材料包我不确定.

这是我的(dialog.components.ts):

import {Component, OnInit} from '@angular/core';
import {MatDialogRef} from '@angular/material'

@Component({
    selector: 'app-dialog',
    templateUrl: './dialog.component.html',
    styleUrls: ['./dialog.component.css']
})
export class DialogComponent implements OnInit {

    public receivedNode: any;

    constructor(public dialogRef: MatDialogRef<DialogComponent>) {
    }

    ngOnInit() {
    }

}
Run Code Online (Sandbox Code Playgroud)

在我的模块中:

import {MatButtonModule,MatMenuModule,MatToolbarModule,MatIconModule,MatCardModule, MatDialogRef} from '@angular/material';


 @NgModule({
        imports: [
            CommonModule,
            MatButtonModule,
            MatMenuModule,
            MatToolbarModule,
            MatIconModule,
            MatCardModule,
            RouterModule.forRoot(
                appRoutes,
                {enableTracing: true}
            ),
        ],
        declarations: [],
        exports: [
            MatButtonModule,
            MatMenuModule,
            MatToolbarModule,
            MatIconModule,
            MatCardModule
        ],
        entryComponents: [DialogComponent],
        providers: [MatDialogRef]
    })
    export class DialogModule {
    }
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误: …

angular-material angular

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

通过ajax将js值发送​​到php控制器

我有这个按钮

<button  id="<?php echo $u['id']?>" name="activation" onclick="handleButton(this);" type="submit" class="btn btn-success"></button>
Run Code Online (Sandbox Code Playgroud)

这个按钮与此相关

<td id="<?php echo $u['id']?>"><?php echo $u['id']?></td>
Run Code Online (Sandbox Code Playgroud)

我正在使用此脚本将按钮的值发送到我的php控制器

function handleButton(obj) {
    var javascriptVariable = obj.id;
//  alert (javascriptVariable);
    $.ajax({
          type: "POST",
          url: "<?php echo base_url(); ?>index.php/admin/active_users",
          dataType: 'text',
          data: 'myname='+javascriptVariable,
          success: function (data){
            }

    });
}
Run Code Online (Sandbox Code Playgroud)

当我使用警报时,结果javascriptVariable是正确的,我希望它在我的控制器中,所以我在我的控制器中尝试这样做:

if(isset($_POST['activation']))
{
    $name = $this->input->post('myname');
    var_dump($name);
}
Run Code Online (Sandbox Code Playgroud)

但我得到了null价值,有什么不对?

javascript php ajax jquery

2
推荐指数
1
解决办法
615
查看次数

使用 Angular 9 使用特殊加载器

我将我的项目升级到 Angular 9。我正在使用 SSR,升级我的webpack.config.js变成webpack.config.js.bak. 现在我正在尝试做ng build --prod && ng run [projectName]:server:production

\n\n

现在我收到此错误消息

\n\n
    ERROR in ./node_modules/canvas/build/Release/canvas.node 1:2\n    Module parse failed: Unexpected character \'\xef\xbf\xbd\' (1:2)\n    You may need an appropriate loader to handle this file type, currently no loaders are configured \n    to process this file. See https://webpack.js.org/concepts#loaders\n    (Source code omitted for this binary file)\n
Run Code Online (Sandbox Code Playgroud)\n\n

所以我尝试实现诸如此类的加载器node-loader,我需要知道我是否应该更新我的加载器server.ts,因为我可以看到webpack.config.js在我的情况下不再需要。

\n\n

编辑:

\n\n

我尝试过angular.json但仍然不起作用

\n\n
"server": {\n          "builder": "@angular-devkit/build-angular:server",\n          "options": …
Run Code Online (Sandbox Code Playgroud)

webpack angular angular9

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

标签 统计

angular ×3

angular9 ×2

ajax ×1

angular-material ×1

ivy ×1

javascript ×1

jquery ×1

php ×1

webpack ×1