ng-action不在表单中添加action属性 [英] ng-action does not add action attribute in the form

查看:115
本文介绍了ng-action不在表单中添加action属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在表单中包含动态操作属性。我有一个代码

I want to have dynamic action attribute in the form. I have a code

 <form ng-action="/users/{{user.id}}">
 </form>

Angular确实取代 {{user.id}} 使用实际值,但不会使用新值添加 action 属性。我该如何解决这个问题?

Angular does replaces {{user.id}} with the actual value, but it does not add action attribute with the new value. How do i fix this?

我也试过

<form action="/users/{{user.id}}"></form>

它在Angular中工作 1.2.1 ,但不是更高版本(> 1.2.1)

It does working in Angular 1.2.1, but not in higher version (>1.2.1)


  1. JSFiddle with角度版 1.2.1 http://jsfiddle.net/fizerkhan/ s8uCT / 5 /

  2. JSFiddle与角度版本 1.2.2 http://jsfiddle.net/fizerkhan/s8uCT/6/

  1. JSFiddle with angular version 1.2.1, http://jsfiddle.net/fizerkhan/s8uCT/5/
  2. JSFiddle with angular version 1.2.2, http://jsfiddle.net/fizerkhan/s8uCT/6/

我也试过角度版 1.2.4 1.2.6 ,它不起作用。

I also tried with angular version 1.2.4, 1.2.6, it does not work.

推荐答案

Angular中没有名为ng-action的指令

There is no directive called ng-action in Angular

参考Angular DOCS

refer Angular DOCS

<form action="{{'/users/' + user.id }}">

您需要添加以上标记才能正常工作

You need to add above tag for that to work

这篇关于ng-action不在表单中添加action属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆