小编xze*_*gga的帖子

从组件调用的多个角度4指令实例补充了输入值

我有一个角度4的组件,被称为三次.在模板元数据中,我有一个带有指令的div,带有一些这样的绑定.

@import {gServ} from '../gServ.service';

@Component: ({
   selector: 'sr-comp',
   template: `<div gDirective [cOptions]="dataChart">`
})

export class SGComponent implements OnInit {
    @Input('report') public report: IReportInstance;
    cOptions:any;

    constructor(private gServ: gServ) {
    }

    ngOnInit(){

        this.cOptions = {};
        this.cOptions = this.gServ.objectMerge(this.gServ.defaultOpt, this.report.opt);

        //this.report.opt is binded to a component when is instantiated.
        //this.gServ.objectMerge is a function that merge the two objects
    }
}
Run Code Online (Sandbox Code Playgroud)

this.cOptions改变了组件的每个实例,然后在指令中我有这个:

import { Directive, ElementRef, HostListener, Input, OnInit } from '@angular/core';

@Directive({
  selector: '[gDirective]'
})
export class SGDirective implements OnInit {
  public …
Run Code Online (Sandbox Code Playgroud)

javascript angular-directive angular-components angular

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

将身份验证包含到 $.getJSON

我使用以下代码从 api 获取 json 数据:

$.getJSON( '../propertylocator/api/configurations', function(data) { 
        $.each( data.rows, function(i, rows) {
            //var homeLatlng= new google.maps.LatLng(0, -180);
            $('#map_canvas').gmap('addShape', { 
                'Polyline': new google.maps.LatLng(rows.latitude, rows.longitude), 
                'bounds': true 
            }).click(function() {
                $('#map_canvas').gmap('openInfoWindow', { 'content': '<strong><a href="detailPage.php?id='+ rows.propertyid +'">'+rows.propertyname+'</a></strong><br/>'+rows.propertyoverview }, this);
        });
});
Run Code Online (Sandbox Code Playgroud)

工作正常,但昨天我已经在 Web 应用程序中包含了带有加密密码的基本身份验证,如何在获取 json api 时包含此代码的身份验证以进行身份​​验证?

谢谢

javascript rest jquery json getjson

5
推荐指数
0
解决办法
9650
查看次数

UNCSS与多个类选择器无法正常工作

我在我的angular js应用程序中为某些元素使用多个类选择器,如下所示:

<p class="first second">som text</p>
Run Code Online (Sandbox Code Playgroud)

在我的CSS文件中,我具有.first和.first.second的其他更特定的属性:

.first{
   ...
}

.first.second{
   ...
}
Run Code Online (Sandbox Code Playgroud)

我的问题是,当我运行咕噜uncss时,生成的文件读取。第一。第二类,但不能两者在一起,就像.first.second的问题是,我一直在使用这种方法,我有成千上万这样的选择的我的应用

如何配置uncss来忽略用多个类定义的所有选择器,而不用在uncss ignore选项中一个接一个地编写?

我是否不了解配置方面的约定?

谢谢!

gruntjs uncss

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

谷歌图表中悬停时的垂直线

我正在我的项目中使用谷歌折线图和 angularjs 指令,我正在搜索如何在悬停时获得垂直线,例如谷歌趋势而不是放置固定线,但我找不到如何做到这一点。

这就是我想要尝试做的:

在此输入图像描述

我只是隐藏垂直线,但在鼠标悬停时不显示,这是我对 angular-google-chart 指令的选项

options: {
  vAxis: {
    title: 'My title',
    gridlines: {
      count: 10
    }
  },
  hAxis: {
    title: 'title hAxis',
    gridlines: {
      color: 'transparent'
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

javascript charts google-visualization angularjs angular-chart

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

如何将文件从 cpanel 帐户下载到另一个 cpanel 帐户

我试图从托管在另一个 cpanel 帐户中的 cpanel 帐户的 SSH 下载文件,但只有当我登录源 cpanel 帐户时才能下载此文件,我正在 WinCSP 客户端上与 SSH 连接,并运行此命令但返回拒绝访问。

这是命令行:

wget --user myusername --password mypassword http://www.domainname.com:2082/cpsess45379/getbackup/backup-domainname.com-2-23-2016.tar.gz
Run Code Online (Sandbox Code Playgroud)

我不是 linux 专家,你能帮我告诉我是什么问题吗?这是来自 SSH 的响应:

在此处输入图片说明

linux ssh wget cpanel file-transfer

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

在子模块中使用来自导入模块的组件

我有一个导出组件以将其公开给其他模块的模块,我想在作为另一个模块的子模块的模块中使用此组件,我正在导入父模块中的第一个模块以启用子模块内部但是,我我并不完全相信这是最好的方法。

这是我在根文件夹中的共享模块,其中包含我要使用的组件:

应用程序/共享/shared.module.ts

import {dtComponent} from './dt.component';

@NgModule({
  imports: [
    CommonModule
  ],
  exports: [
    dtComponent
  ],
  declarations: [
    dtComponent
  ]
})
export class DatePModule{ }
Run Code Online (Sandbox Code Playgroud)

我在 app 文件夹中有另一个模块,它像这样导入DatePModule

应用程序/联系人/contacts.module.ts

import {DatePModule} from '../shared/shared.module.ts';

@NgModule({
  imports: [
    CommonModule,
    DatePModule
  ]
})
export class CTModule{ }
Run Code Online (Sandbox Code Playgroud)

我需要使用dtComponent直接的一些组件CTModule,还需要在在的子模块等组件此组件CTModule

我可以在CTModule的子模块中再次导入DatePModule,但我不相信这是最好的方法。

应用程序/联系人/其他/other.module.ts

import {DatePModule} from '../../shared/shared.module.ts';

@NgModule({
  imports: [
    CommonModule,
    DatePModule
  ]
})
export class OtherModule{ }
Run Code Online (Sandbox Code Playgroud)

我的问题是,如果DatePModule已经导入到父模块中,为什么我需要再次导入?如果我在OtherModule 中删除此导入,则组件 …

angular-module angular-components angular

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

No value accessor for form control with name... for mat-select controls

I am making some unit test with jasmine and karma for an angular 6 app that validate if a formGroup field is valid. I am experiencing problems with mat-select control. when I run the test case, Karma fires me an error saying Error: No value accessor for form control with name: 'importId'. By the way, the component works fine as I expected.

在此处输入图片说明

This is my component:

import {Component, Inject, OnInit} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material";
import {FormBuilder, …
Run Code Online (Sandbox Code Playgroud)

unit-testing karma-jasmine angular-material angular

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