小编Pra*_*n D的帖子

如何使用promises将参数传递给AngularJS中的函数

我想把参数发送到服务功能.

getQuestions:function(stateCode):questionResource.js

stateCode在dtoResource.rc1Step1DTO()的响应中设置在$ scope中

angular
    .module('autoQuote')
    //Do initalization on page load
    .run(['$log', '$rootScope', '$state', 'dtoResource', 'questionResource', function($log, $rootScope, $state, dtoResource, questionResource) {
        $log.info('Post DTO on page load.');
        dtoResource.rc1Step1DTO()
            .then(questionResource.getQuestions)
            .then(function(questions) {
                $rootScope.questions = questions;
                console.log('Obtained questions. Assigned to rootscope');
            })
            .then(function() {
                console.log('This should be printed after the above methods are done     executing');
                console.log($rootScope);
            });

    }])
Run Code Online (Sandbox Code Playgroud)

如何将状态代码传递给其他函数.它在范围上的地位是

$scope.postAutoQuoteObj.SessionInfo.StateCode
Run Code Online (Sandbox Code Playgroud)

以下是代码http://plnkr.co/edit/Op1QDwUBECAosPUC7r3N?p=preview的plunker

javascript jquery angularjs

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

如何加载两个mo文件进行gettext本地化

我试图解决这个加载两个mo文件.我有两个mo文件都有不同的msgid和msgstr.

我的文件夹结构如下.local/en_US/LC_MESSAGES/lang.mo local/en_US/LC_MESSAGES/brand.mo

以下代码我用来加载mo文件.

define('PROJECT_DIR', realpath('./'));
define('LOCALE_DIR', PROJECT_DIR .'/locale');
define('DEFAULT_LOCALE', 'en_US');
$encoding = 'UTF-8';
$locale = (isset($_SESSION['lang']))? $_SESSION['lang'] : DEFAULT_LOCALE;
// gettext setup
T_setlocale(LC_MESSAGES, $locale);
// Set the text domain as 'messages'
$our_domain = 'lang';
T_bindtextdomain($our_domain, LOCALE_DIR);
T_bind_textdomain_codeset($our_domain, $encoding);
T_textdomain($our_domain);
Run Code Online (Sandbox Code Playgroud)

我怎么能在这里添加一个mo文件

php mysql gettext

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

使用Javascript从url中删除参数

我想从URL中删除参数而不重新加载或刷新页面.

我使用下面的代码,它工作正常.

jQuery(document).ready(function($) {    
    window.history.pushState("", "", "/" );
});
Run Code Online (Sandbox Code Playgroud)

但问题是,如果我点击浏览器后退按钮,我可以在网址中看到参数.

html javascript php jquery html5-history

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

AngularJS 缩小的 js 文件不起作用

我将所有 js 文件缩小并合并为一个文件,并包含在 html 中,但站点中没有任何内容。

js里面文件太多了,不想一一包含,所以修改合并为一个。

有没有其他方法可以减少对 js 文件的 http 调用次数。

javascript php jquery minify angularjs

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

如何在 spring boot 中从 application.properties 文件制作可配置的可重试 maxAttempts 和退避

下面的参数,试图使可配置

@Async("threadPoolTaskExecutor")
@Retryable(value = MessagingException.class, maxAttempts = 2, backoff = @Backoff(delay = 5000))
Run Code Online (Sandbox Code Playgroud)

我在 application.properties 文件中做了以下更改

my.app.maxAttempts = 2
my.app.backOffDelay = 5000
Run Code Online (Sandbox Code Playgroud)

@Retryable(value = MessagingException.class, maxAttempts = "${my.app.maxAttempts}", backoff = @Backoff(delay = "${my.app.my.app.backOffDelay}"))
Run Code Online (Sandbox Code Playgroud)

但得到以下错误。不兼容的类型。找到java.lang.String。需要'int'

在 build.gradle 文件中我有

dependencies {
    compile ("org.springframework.boot:spring-boot-starter-web")
    compile ("org.springframework.boot:spring-boot-starter-mail:2.1.2.RELEASE")
    compile ("org.springframework.boot:spring-boot-starter-security:2.1.2.RELEASE")
    compile ("org.springframework.boot:spring-boot-starter-aop")
    compile ("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("org.springframework.boot:spring-boot-starter-jdbc:2.1.0.RELEASE")
    compile ("org.springframework.retry:spring-retry:1.2.4.RELEASE")
    compile ("io.springfox:springfox-swagger2:2.9.2")
    compile ("io.springfox:springfox-swagger-ui:2.9.2")
    compile ("io.springfox:springfox-bean-validators:2.9.2")
    compile ("javax.validation:validation-api:2.0.0.Final")
    compile ("org.hibernate.validator:hibernate-validator")
    compile ("org.hibernate.validator:hibernate-validator-annotation-processor")
//  compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.9.8'
    compile ("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8")
    compile("org.postgresql:postgresql")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    testImplementation('org.springframework.boot:spring-boot-starter-test')
    testImplementation('org.springframework.batch:spring-batch-test')
    testCompile …
Run Code Online (Sandbox Code Playgroud)

java spring multithreading spring-retry spring-boot

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