小编San*_*nnu的帖子

无法在角度5中使用ng-include

对Angular很新,并使用Angular 5和Visual Code进行小型试点项目.我正在尝试使用ng-include,但模板无法显示.

  src
     add-device
        add-device.component.html
        add-device.component.scss
        add-device.component.spec.ts
        add-device.component.ts
     edit-device
        edit-device.component.html
        edit-device.component.scss
        edit-device.component.spec.ts
        edit-device.component.ts
     templates
        device.html
     app.module.ts
     app.coponent.ts
     app.component.html
     ....
Run Code Online (Sandbox Code Playgroud)

简单的device.html代码

<div>Include is working!</div>
Run Code Online (Sandbox Code Playgroud)

附加device.component.html

<div ng-include="" src="'templates/device.html'">
    <div>More unique elements here!</div>
</div>
Run Code Online (Sandbox Code Playgroud)

我也试过跟随

<div ng-include="" src="'templates/device.html'"></div>

<div ng-include="'templates/device.html'"></div>
Run Code Online (Sandbox Code Playgroud)

以下给出错误,无法识别ng-include.

<ng-include src="'templates/device.html'"></ng-include>
Run Code Online (Sandbox Code Playgroud)

目标是使用来自添加和编辑设备组件的device.html模板代码.我正在使用typescript来管理项目.当我在调试器中查看Sources时,我甚至没有在源列表中看到device.html文件.

typescript angular

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

当gridview设置为true时,Jqgrid在IE9中显示"正在加载"

我的网格在firefox和chrome中运行良好,但是当gridview设置为true时,它在IE9中显示"正在加载"图标.这是使用jqgrid 4.7.0

var setGrid = $("#recordSetsGrid");
var gridView=false; //setting this to true in IE9 causes grid not to show with only message 'Loading'.

setGrid.jqGrid(
        {
            ajaxGridOptions: {cache: false},
            url : getUrlContext()+loadUrl,
            postData : {
                searchText : function() {
                    return $("#" + setSearchTextId)
                            .val();
                }
            },
            datatype : "json",
            editurl : setGrid_editUrl,
            colNames : ["","Record Set", "Origin",
                    "Origin", "Organization",
                    "Sharing", "Active?",
                    "Comments" ],
            editCaption : "Edit Record Set",
            colModel : [
                    {
                        name : "crud",
                        width : 10,
                        fixed : true, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jsp jqgrid

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

Spring AMQP(Rabbit)Listener在发生异常时进入循环

@Bean
RabbitTemplate rabbitTemplate() {
    RabbitTemplate template = new RabbitTemplate(rabbitConnectionFactory());
    template.setMessageConverter(messageConverter);
    template.setExchange(amqpProperties.getRabbitMqTopicExchangeName());
    return template;
}

@Bean
@Conditional (OperationsCondition.class)
 SimpleMessageListenerContainer opsMessageListenerContainer() {
    return listenerContainer(amqpProperties.getRabbitMqOperationsQueue(), 
            amqpProperties.getInitialRabbitOperationsConsumerCount(), 
            amqpProperties.getMaximumRabbitOperationsConsumerCount(),
            opsReceiver());
}

@Bean
@Conditional (OperationsCondition.class)
OperationsListener opsReceiver() {
    return new OperationsListener();
}

private SimpleMessageListenerContainer listenerContainer(String queue,
        int initConsumers,int maxConsumers, MessageListener listener)
{
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(rabbitConnectionFactory());
    container.setQueueNames(queue);
    container.setMessageListener(listener);
    container.setConcurrentConsumers(initConsumers);
    container.setMaxConcurrentConsumers(maxConsumers);
    container.setMessageConverter(messageConverter);
    return container;
}
Run Code Online (Sandbox Code Playgroud)

消息监听器是:

public class OperationsListener  implements MessageListener
{
    public static final Logger logger = Logger.getInstance(OperationsListener.class);

    @Autowired (required=true)
    private OperationsProcessor processor;
    @Autowired …
Run Code Online (Sandbox Code Playgroud)

java spring rabbitmq spring-amqp

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

为什么 Swagger Codegen 将 ON/OFF 字符串枚举转换为 TRUE/FALSE?

我正在使用 Swagger Codegen 3.0.19,还尝试了 OpenAPI Generator 4.0.3。

Java环境:

Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Run Code Online (Sandbox Code Playgroud)

跑步者:

java -jar ./libs/openapi-generator-cli-4.3.0.jar  generate \
       -i pet.yaml \
       -g spring \
       -o ./OUTPUT/api/
Run Code Online (Sandbox Code Playgroud)

这是我的 OpenAPI 架构:

Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Run Code Online (Sandbox Code Playgroud)

输出是:

java -jar ./libs/openapi-generator-cli-4.3.0.jar  generate \
       -i pet.yaml \
       -g spring \
       -o ./OUTPUT/api/
Run Code Online (Sandbox Code Playgroud)

为什么代码生成器将 ON/OFF 枚举转换为 TRUE/FALSE?当我使用 Swagger Editor GUI 生成时,它不会执行此操作。

yaml openapi swagger-codegen openapi-generator

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

具有多个实体查找器的通用 spring jpa 存储库

我的应用程序有超过 250 个表,每个表都有 ID 和名称列。我正在尝试使用 hibernate 5+ 将我们的应用程序从 hibernate 3 迁移到 Spring-JPA 4.3。

在我当前的休眠层中,我有(选项 1):

public class DAO
{
    private Session session;

    public DAO(Session session)
    {
        this.session=session;
    }

    public EntityA findById(String id)
    {
        //implementation
        return entityA;
    }
    public EntityB findByName(String name)
    {
        //implementation
        return entityB;
    }
    public EntityC findByIdAndName(String id, String name)
    {
        //implementation
        return entityC;
    }
}
Run Code Online (Sandbox Code Playgroud)

回到过去,我可以使用更通用的方法完成以下操作,但如果我有 10 个不同的实体要通过 ID 获取,我不想重新初始化此类。

public class DAO<T>
{
    public T findById(String id)
    {
        //implementation
        return T;
    }
    public T findByName(String name) …
Run Code Online (Sandbox Code Playgroud)

spring hibernate spring-data-jpa spring-boot

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

Springboot异常处理程序没有捕获异常

在 Spring Boot 和 Rest 应用程序中,我配置了一个异常处理程序,如下所示。如果在请求使其停止服务后抛出异常,它可以正常工作。

Rest api 需要“application/json”的内容类型,如果我不将该内容类型标头发送到 api,异常处理程序不会捕获异常。它在日志中打印以下信息:

DEBUG [o.s.w.s.DispatcherServlet] DispatcherServlet with name 'dispatcherServlet' processing PUT request for [/app/v1.0/customers/customer/zones/zoneName.]
DEBUG [o.s.w.s.m.m.a.RequestMappingHandlerMapping] Looking up handler method for path /app/v1.0/customers/customer/zones/zoneName.
DEBUG [o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver] Resolving exception from handler [null]: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text/plain' not supported
DEBUG [o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver] Invoking @ExceptionHandler method: public final org.springframework.http.ResponseEntity<java.lang.Object> org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler.handleException(java.lang.Exception,org.springframework.web.context.request.WebRequest)
DEBUG [o.s.w.s.DispatcherServlet] Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
DEBUG [o.s.w.s.DispatcherServlet] Successfully completed request
Run Code Online (Sandbox Code Playgroud)

这是异常处理程序类:

@ControllerAdvice
@RestController  
public class ServiceExceptionHandler extends ResponseEntityExceptionHandler …
Run Code Online (Sandbox Code Playgroud)

java rest spring-boot

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

无法对齐数据表小平面页脚中的按钮

使用Primefaces 6.1,我想在数据表页脚面上添加几个按钮.当我使用float:left时,按钮向左移动但是页脚部分(div)收缩.

<f:facet name="footer">
    <p:button styleClass="tableButtons" value="Edit" update="msgs"/>
</f:facet>  
Run Code Online (Sandbox Code Playgroud)

默认输出为:

在此输入图像描述

现在,如果我添加浮动:

    .tableButtons {
         float: left;
    }
Run Code Online (Sandbox Code Playgroud)

输出是:

在此输入图像描述

css primefaces

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