我有一个AngularJS应用程序,它从输入中收集数据,使用模型将模型转换为字符串,JSON.stringify()并允许用户编辑此模型,以便在<textarea>元素更新时输入字段更新,反之亦然.某种双向绑定:)
问题是String本身看起来很难看,我想格式化它,所以它看起来像这样:

而不是现在看起来像:

有什么想法可以实现吗?如果您需要一些额外的信息 - 请不要犹豫.每个答案都受到高度赞赏并立即得到解答
谢谢.
PS我想这应该是某种指令或自定义过滤器.数据本身不应该被改变,只有输出.
我有JSF 2.2,PrimeFaces 5.0 Web应用程序.
在我的页面上,我需要有条件地设置<ui:param/>.问题是标准的三元运算符是不够的,因为我有两个以上的选项可供选择.此单页用作两种类型用户的编辑和创建页面:普通用户和医生.
这是我尝试过的:
<ui:param name="edit_title"
value="#{empty dto.id ?
(bean.isPhysician ? msg.physicianNewTitle : msg.userNewTitle) :
(bean.isPhysician ? msg.physicianEditTitle : msg.userEditTitle)}" />
Run Code Online (Sandbox Code Playgroud)
结果显示错误的标题,什么时候dto.id是空的,bean.isPhysician是假的,我找不到问题或更好的解决方案.试图像在这里说的那样有条件地设置它,但是由于某种原因它不起作用.
有谁知道如何解决这种麻烦?
每个有用的答案都受到高度赞赏和评价.
谢谢.
需要创建一个由注册模块和主项目组成的多模块maven项目.问题是不可能使用在不同模块中声明的类.
例如:我ParentClaz在父母的src/main/java目录和ChildClaz子目录的src/main/java目录中有一个.现在这是不可能既不使用ParentClaz中ChildClaz也不反之亦然.
该项目的结构如下所示:
+-- AdminPortal <- parent root
+-- registration <- child root
-- pom.xml <- child pom
-- pom.xml <- parent pom
Run Code Online (Sandbox Code Playgroud)
我的AdminPortal POM:
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>AdminPortal</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>AdminPortal</name>
<url>http://maven.apache.org</url>
<modules>
<module>registration</module>
</modules>
Run Code Online (Sandbox Code Playgroud)
这是孩子POM:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example</groupId>
<artifactId>AdminPortal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.example.AdminPortal</groupId>
<artifactId>registration</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>registration</name>
<url>http://maven.apache.org</url>
Run Code Online (Sandbox Code Playgroud)
怎样才能解决这个问题?
我希望能够在<textarea>元素中编辑和显示复杂模型.这是用于从JSON响应动态生成模型字段的HTML部分:
<p>parent uuid*: </p>
<input ng-model="parentUuid" capitalize type="text" placeholder="String"
class="form-control" style="width:200px; display: inline-block;"/> <br/>
<p>resource*:</p>
<select ng-model="childResource" ng-change="loadResourceFields(childResource)"
class="form-control" style="width:300px; display: inline-block;">
<option ng-repeat="childResource in restResources">{{childResource}}</option>
</select>
<div ng-repeat="field in childFields">
<div ng-show={{!field.isEnum}}>
<p ng-show={{field.isRequired}}>{{field.name}}*: </p>
<p ng-show={{!field.isRequired}}>{{field.name}}: </p>
<input type="text" ng-model="createChildResource[field.name]"
class="form-control" style="width:200px; display: inline-block;" placeholder="{{parseClassName(field.type)}}">
</div>
<div ng-show={{field.isEnum}}>
<p ng-show={{field.isRequired}}>{{field.name}}*: </p>
<p ng-show={{!field.isRequired}}>{{field.name}}: </p>
<select ng-model="createChildResource[field.name]" class="form-control" style="width:auto; display: inline-block;">
<option></option>
<option ng-repeat="enumValue in field.enumValues" label={{enumValue.name}}>{{enumValue.ordinal}}</option>
</select>
</div>
</div>
<div class="preview">
<p>Preview: </p>
<textarea style="height:350px; width:550px; …Run Code Online (Sandbox Code Playgroud) 我有一个AngularJS,JS,JQ,HTML5,CSS3网络应用程序.它可以将不同的HTTP方法发送到我们项目的REST API并对其进行操作.它与Restlet(以前的Dev HTTP Client)的DHC具有类似的行为.每个请求都返回一个状态代码,如200,201,404,500等,然后显示给用户.
现在我想要的不仅是显示响应代码,还要显示它的描述如下:
404 Not Found,201 Created等等.
我得到Angular的回复,如下所示:
$http(config).success(function (data, status, headers, config) {//some logic}
Run Code Online (Sandbox Code Playgroud)
有没有人知道使用AngularJS是否可行?