小编Luc*_*cas的帖子

Eclipse上未定义的属性名称(ng-model)

我的Eclipse指责标签"ng-model"出错

当我保存文件时,我的eclipse警告ng-model att:

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Angular Learn</title>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script src=../javascript/personController.js></script>
<script src=../javascript/carController.js"></script>
</head>
<body>
<div ng-app="" ng-controller="carController">
    <input type="text" ng-model="firstName"> <br>  // at this line
    <input type="text" ng-model="secondName">
    <p> {{ firstName + " " + secondName }} </p>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

eclipse angularjs

15
推荐指数
3
解决办法
5万
查看次数

为什么angular.forEach上下文?

我正在分析这个angular.forEach功能:

这是代码angular.forEach:

var values = {name: 'misko', gender: 'male'};
var log = [];

angular.forEach(values, function(value, key) {
  this.push(key + ': ' + value);
}, log);

expect(log).toEqual(['name: misko', 'gender: male']);
Run Code Online (Sandbox Code Playgroud)

上下文的描述是:

对象成为迭代器函数的上下文(this).

我想出了一些问题:

为什么使用和何时对参数上下文有用?!

为什么用这个代替日志变量

javascript foreach angularjs

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

如何在$ scope AngularJS中声明Object

我正在使用AngularJS并且我正在尝试创建一个模板,其中我有一个隐式对象,它调用test和内部测试我有一个数组,当我在Controller中调用一个函数时我想重复,但是我得到了未定义的当我尝试在数组中推送一个对象时出错.

以下是我的代码示例:

<body ng-app="MyApp" ng-controller"MyController">
    <input ng-model="person.name">
    <button ng-click="createPhone()">
    <div data-ng-repeat="phone in person.phones">
        <input ng-model="phone.number">
    </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

这是我的控制器:

//app.controller...
    $scope.createPhone(){
        var phone = {number: '123456789'};
        $scope.person.phones.push(phone);
    }
Run Code Online (Sandbox Code Playgroud)

我越来越:

TypeError:无法设置undefined属性'phones'.

谁能帮助我?

javascript angularjs

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

如何在Spring中处理多个文件和消息以实现国际化?

一些关于Spring国际化的文章讲述了如何交换传递语言环境等的消息,但我只发现包含一些消息的用例.

  • 如何根据上下文组织和使用国际化文件?(验证,查看消息,默认消息,业务消息)

  • 我知道Spring使用模式(定义的消息文件的名称)+ locale.例如:message_zh_CN.如何知道这种行为的每个上下文文件?

我认为它应该是:

resources
`-- messages
    |-- validation
    |   |-- message_locale.properties
    |   `-- message_locale2.properties
    |-- business
    |   |-- message_locale.properties
    |   `-- message_locale2.properties
    `-- view
        |-- message_locale.properties
        `-- message_locale2.properties
Run Code Online (Sandbox Code Playgroud)

要么:

resources
`-- messages
    |-- validation
    |   |-- validation_locale.properties
    |   `-- validation_locale2.properties
    |-- business
    |   |-- business_locale.properties
    |   `-- business_locale2.properties
    `-- view
        |-- view_locale.properties
        `-- view_locale2.properties
Run Code Online (Sandbox Code Playgroud)

java spring internationalization

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

如何使用 Mockito 在父类中注入模拟?

我正在使用mockito来嘲笑我的服务..

如何在父类中注入模拟?

样本:

public abstract class Parent(){

    @Mock
    Message message;

}

public class MyTest() extends Parent{

    @InjectMocks
    MyService myService //MyService has an instance of Message

    //When I put @Mock Message here it works
}
Run Code Online (Sandbox Code Playgroud)

当我运行测试时,消息会Parent保留null

unit-testing mockito

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

如何在Spring中使用多个名称命名@Service?

我需要类似的东西:

@Named({"bean1", "bean2"})

@Service({"bean1", "bean2"})
Run Code Online (Sandbox Code Playgroud)

有人能帮我吗?

spring

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

Maven集成测试在相同的包结构中找不到我的类

这是我的文件:


Pom父母:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.group</groupId>
    <artifactId>my.artifact.pom</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <modules>
        <module>my.artifact.ws</module>
    </modules>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
    </parent>

    <properties>
        <!-- test -->
        <maven.test.failure.ignore>false</maven.test.failure.ignore>
    </properties>

    //lot of dependencies...

    <!-- PROFILES -->
    <profiles>
        <profile>
            <id>local</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
                <unit-tests.skip>false</unit-tests.skip>
                <integration-tests.skip>true</integration-tests.skip>
            </properties>
        </profile>
        <profile>
            <id>integration</id>
            <modules>
                <module>my-module-integration-test</module>
            </modules>
            <properties>
                <unit-tests.skip>true</unit-tests.skip>
                <integration-tests.skip>false</integration-tests.skip>
            </properties>
        </profile>
    </profiles>

    <!-- PLUGIN -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>${encoding}</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
Run Code Online (Sandbox Code Playgroud)

Module-ws pom:

<project xmlns="http://maven.apache.org/POM/4.0.0" …
Run Code Online (Sandbox Code Playgroud)

java testing integration-testing maven

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