小编Mik*_*hun的帖子

如何使用打字稿将 string[] 数组添加到 record<string,boolean> 格式中?

我有一个字符串数组,我想保留这些值并创建一个新的数组记录

对于 userValue 中的每个值。

例子

 userValue: string[] = ["1111","2222","3333","4444"];


  selectedOptions: Record<string, boolean> = {
    //how to add userValue array into here?
    1111: true, //hardcoded
    2222: true, //hardcoded
    3333: true, //hardcoded
    4444: true //hardcoded
  };
Run Code Online (Sandbox Code Playgroud)

arrays typescript angular

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

如何在HTML上的AngularJS中使用foreach

如何在angular js中使用foreach语句?我当前的数据以json格式打印出来。我想将其打印在新行上。

HTML

<p>{{controller.greeting.custinfo}}</p>

 //attempt
<p ng-repeat= >{{controller.greeting.custinfo}}</p>
Run Code Online (Sandbox Code Playgroud)

在UI上输出

{"id":null,"biling_address":"null","billing_state":"FL","ip_Addresses":["123:111:2101","","NULL"],name":"jimmmy"}
Run Code Online (Sandbox Code Playgroud)

Java输出

System.out.println(custinfo);
demo.model.cert@ba1983a
Run Code Online (Sandbox Code Playgroud)

如何使用foreach语句以换行显示数据?而不是json格式。

我知道如何用百里香叶做到这一点,下面的例子

<table th:each="custinfo : ${custinfo}">

  <tr>
        <td ng-show="id" class="padded">id:</td>
        <td ng-show="id" th:text="${custinfo.id}" class="padded"></td>
  </tr>
  //continue down
Run Code Online (Sandbox Code Playgroud)

html javascript angularjs angularjs-ng-repeat

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

如果tr与百里香一起为空,如何隐藏父div?

我正在使用百里香框架。如果值显示为空,我想隐藏整个div。并显示它是否不为null。

HTML代码

<div>
<h2> My Table </h2>
    <table border="1">
        <tr bgcolor="powderblue">
            <th>name</th>
            <th>age</th>
            <th>hobby</th>
            <th>interest</th>
            <th>books</th>
            <th>movie</th>
        </tr>
        <tr th:each="table: ${myTable}">

        <td th:text = "${table.name != null ? table.name : 'NULL'}" />
        <td th:text = "${table.age != null ? table.age : 'NULL'}" />
        <td th:text = "${table.hobby != null ? table.hobby : 'NULL'}" />
        <td th:text = "${table.interest != null ? table.interest: 'NULL'}" />
        <td th:text = "${table.books != null ? table.books : 'NULL'}" />
        <td th:text = "${table.movie != …
Run Code Online (Sandbox Code Playgroud)

html javascript css thymeleaf

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

如何将此方法复制到没有参数的方法?

我是java新手,我想知道它是否可行.但是我从另一个班级调用这个方法.但参数让我很难过.我想在没有参数的情况下调用此方法,或者将其转到其他类而没有任何错误.

public List<String> getApporDb(
        String servers,
        String username,
        String password,
        Float critThreshold) throws Exception {

        try {
            //something

            try {
                // another thing
                if (serverArray != null && serverArray.length > 0 && folders != null && folders.length > 0) {

                    logger.info("inside loop of CpuUtilization and MemoryUtilization");
                    Float cpuUtilization = null;

                List<String> memoList = new ArrayList<String>();
                    for (String server : serverArray) {
                        memoList.add(server);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)

基本上我想让这个方法中间的arraylist到另一个类.

另一堂课

public void arrayList() {

databaseClass dbc = new databaseClass();
dbc.getApporDb(String servers,
        String …
Run Code Online (Sandbox Code Playgroud)

java

-7
推荐指数
1
解决办法
83
查看次数