小编Sar*_*ath的帖子

Angular - 没有将"exportAs"设置为"ngModel"的指令

以下是AngularJS项目中的文件.正如一些帖子所建议的那样,我补充说:

ngModel name="currentPassword" #currentPassword="ngModel 
Run Code Online (Sandbox Code Playgroud)

在输入字段中,但仍然出错.

的package.json

.........
"dependencies": {
        "@angular/common": "^2.3.1",
        "@angular/compiler": "^2.3.1",
        "@angular/core": "^2.3.1",
        "@angular/forms": "^2.3.1",
        "@angular/http": "^2.3.1",
        "@angular/platform-browser": "^2.3.1",
        "@angular/platform-browser-dynamic": "^2.3.1",
        "@angular/router": "^3.3.1",
        "core-js": "^2.4.1",
        "rxjs": "^5.0.1",
        "ts-helpers": "^1.1.1",
        "zone.js": "^0.7.2"
    },
   ...............
Run Code Online (Sandbox Code Playgroud)

变化password.component.html

<form #f="ngForm" [formGroup]="changePasswordForm">
        <div class="form-group">
            <label for="currentPassword">Current Password</label> <input
                placeholder="currentPassword" ngModel name="currentPassword"
                #currentPassword="ngModel" id="currentPassword"
                name="currentPassword" type="text" class="form-control" required
                minlength="6" formControlName="currentPassword">
            </div>
        </div>
        <button class="btn btn-primary" type="submit">Change Password</button>
    </form>
Run Code Online (Sandbox Code Playgroud)

变化password.component.ts

import { Component, OnInit } from '@angular/core';
import { FormBuilder, Validators, ControlContainer, FormGroup, FormControl } …
Run Code Online (Sandbox Code Playgroud)

angular2-forms angular2-ngmodel angular

11
推荐指数
4
解决办法
2万
查看次数

使用命令行中的参数运行SBT任务

我想要一个SBT任务,它将逗号分隔的测试类列表作为命令行的输入,由完全限定名称给出.现在我使用硬编码值运行任务但我想从命令行获取它.有人可以帮我写这样的任务吗?

 lazy val runTask = inputKey[Unit]("custom run")

 runTask := {
    val one = (runMain in Compile).fullInput(" org.scalatest.tools.Runner -P1 -C reporter.TestReporter -o -s testcase.GetAccountInfo -s testcase.GetProfileInfo").evaluated
 }
Run Code Online (Sandbox Code Playgroud)

像这样的东西,

 sbt runTask testcase.GetProfileInfo,testcase.GetAccountInfo
Run Code Online (Sandbox Code Playgroud)

提前致谢.

command-line scala task sbt scalatest

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

如何在Windows中使用命令提示符获取Chrome版本

是否可以在Windows中使用命令提示符获取版本安装的chrome版本?

试过了

 "C:\Program Files\Google\Chrome\Application\chrome.exe" -version
 "C:\Program Files\Google\Chrome\Application\chrome.exe" --version
 "C:\Program Files\Google\Chrome\Application\chrome.exe" -product-version
 "C:\Program Files\Google\Chrome\Application\chrome.exe" --product-version
Run Code Online (Sandbox Code Playgroud)

当我这样做时,浏览器实例正在打开。我应该使用什么标志来获取版本。

我使用的是Windows7。Chrome浏览器的版本是67.0.3396.87。

提前致谢

windows terminal command-line google-chrome command-prompt

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

Is there any way to check whether a given class type belongs to Java object or custom object

I was searching for any ways to check whether the type of the given attribute of a class is of custom object type (for eg., Person) or Java object (for eg., String, Long, primitive types as well) type. If instanceof is used, it will be hectic checking all of the Java types. Can anyone suggest a way to check, if anything as such exists.

java reflection types class

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

TestNG @BeforeClass 和测试类构造函数的区别

TestNG@BeforeClass和测试类的构造函数之间有什么区别?它在内部如何运作?

java testng constructor annotations

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

是否可以使用 selenium 在 chrome 中禁用文件下载

使用 ChromeDriver 和 Selenium 访问某些页面时,会自动下载特定文件。由于文件下载,代码没有进一步处理。是否可以使用在创建 ChromeDriver 时可以设置的任何 ChromeOptions 或首选项来禁用文件下载。

尝试了以下 ChromeOptions,但没有任何帮助。

prefs.put("download.default_directory", "NUL");
prefs.put("download.prompt_for_download", false);
prefs.put("profile.default_content_setting_values.automatic_downloads", 0);
Run Code Online (Sandbox Code Playgroud)

java selenium google-chrome selenium-chromedriver

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

@XmlElementWrapper和@XmlElement不使用Jackson进行反序列化

我使用的是jackson-databind:2.9.3和jackson-module-jaxb-annotations:2.9.3

我有以下格式的JSON.

{
    "response": {
        "data": {
            "entry": {
                "name": "xxxxxxxxxx"
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

需要将此JSON响应反序列化为具有以下结构的类.

@XmlRootElement(name = "response")
public class Response {

    private List<Entry> entry;

    public Response() {
    }

    public Response(List<Entry> entry) {
        this.entry = entry;
    }

    @XmlElementWrapper(name = "data")
    @XmlElement(name = "entry")
    public List<Entry> getData() {
        return this.entry;
    }

    public void setData(List<Entry> entry) {
        this.entry = entry;
    }
}

public class Entry {

    private String name;

    public String getName() {
        return this.name;
    }

    public void setName(String name) { …
Run Code Online (Sandbox Code Playgroud)

java json jaxb jackson deserialization

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

如何使用加特林执行条件检查

我有一个这样的场景。

 private val feeder = Array(200, 404).map(e => Map("code" -> e)).random.circular

 private val search = scenario("search")
                          .feed(feeder)
                          .exec(http("search")
                          .get("/search/")
                          .headers(headers)
                          .check( if "${code}".equals(200) jsonPath("$.body").exists else jsonPath("$.exception").exists )
Run Code Online (Sandbox Code Playgroud)

有没有办法可以实现这种条件检查。截至目前,观察到的行为是,“${code}”.equals(200)将始终返回 false。

scala gatling scala-gatling

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

Spring Boot和Spring Data REST中的MongoDB配置

我想使用spring-boot和JPA将MongoDB用于mongoDB.我可以使用嵌入式H2数据库.但我不确定使用mongo-db会出现什么问题.在运行应用程序时,我收到数据源丢失的错误.

@EnableAutoConfiguration
@EnableJpaRepositories(basePackages = "com..........repo")
@EnableWebMvc
@Configuration
@ComponentScan
@Import({ SpringMongoConfig.class, RepositoryRestMvcConfiguration.class })
public class Bootstrap extends SpringBootServletInitializer {

   public static void main(String[] args) {
       SpringApplication.run(Bootstrap.class, args);
   }

   @Override
   protected SpringApplicationBuilder configure(
           SpringApplicationBuilder application) {
       return application.sources(Bootstrap.class);
   }
}
Run Code Online (Sandbox Code Playgroud)

.

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;

import com.mongodb.Mongo;
import com.mongodb.MongoClient;

@Configuration
@EnableMongoRepositories(basePackages = "com.............repo")
@PropertySource(value = "classpath:mongo-config.properties")
public class SpringMongoConfig extends AbstractMongoConfiguration {

@Value("${MONGO_DB_HOST}")
private String MONGO_DB_HOST;

@Value("${MONGO_DB_PORT}")
private int MONGO_DB_PORT;

@Value("${DB}")
private String DB; …
Run Code Online (Sandbox Code Playgroud)

spring mongodb spring-data spring-data-rest spring-boot

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

如何使用不同的参数多次运行 rspec 类

我有一个带有一组测试的 rspec 类。我想使用不同的参数多次运行相同的 rspec 测试类。在 rspec 中可能吗?如果是这样,有人可以帮我举个例子。

describe 'run test' do
  param = ''

  it 'xyz' do
    ...
    puts param
    ...
  end

  it 'abc' do
    ...
    puts param
    ...
  end

end
Run Code Online (Sandbox Code Playgroud)

所以,我想用不同的参数值多次运行这个 rspec 类。

提前致谢。

ruby unit-testing rspec ruby-on-rails parameter-passing

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