Angular模块会覆盖我的文本框以获取模型值 [英] Angular module overrides my textboxfor model value

查看:91
本文介绍了Angular模块会覆盖我的文本框以获取模型值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在使用asp.net mvc textboxfor如下

Hi guys,

I am using asp.net mvc textboxfor like below

@Html.TextBoxFor(p => p.FirstName, new { data_ng_model="FirstName"})


来自服务器的
我填充模型然后将其分配给我的视图


from server i am filling model then assigning it to my view

FirstName="Some Name"



和角度我分配如下


and in angular i assigned like below

$scope.FirstName=""





在我的文本框中我想得到Some Name,它应该得到分配给 $ scope.FirstName ,因为我将它用作角度模型。但实际发生的是角度模型会覆盖我的服务器模型值。

显示即空白

注意:当我不使用angualr它工作正常或者我们什么时候指定了一些角度模型,如



In my textbox i want to get "Some Name" and it should get assigned to $scope.FirstName as I am using it as angular model. but what actually happens is angular model overrides my server model value.
it show "" i.e. empty
Note: When I am not using angualr it works fine or when ever we assigned some to angular model like

$scope.FirstName="Other Name"

它在文本框中显示其他名称。

伙计们建议我如何使用角度模型和TextBoxFor和角度模型和TextBox应该显示服务器模型值。





提前谢谢。

it shows "Other Name" in textbox.
Guys suggest me how to use angular model and TextBoxFor and angular model and TextBox should display server model value.


Thanks in advance.

推荐答案

scope.FirstName =
scope.FirstName=""





在我的文本框中我想得到一些名字它应该被分配到



In my textbox i want to get "Some Name" and it should get assigned to


scope.FirstName ,因为我将它用作角度模型。但实际发生的是角度模型会覆盖我的服务器模型值。

显示即空白

注意:当我不使用angualr它工作正常或者我们什么时候分配给角度模型,如
scope.FirstName as I am using it as angular model. but what actually happens is angular model overrides my server model value.
it show "" i.e. empty
Note: When I am not using angualr it works fine or when ever we assigned some to angular model like


scope.FirstName =Other Name
scope.FirstName="Other Name"

它在文本框中显示其他名称。

伙计们建议我如何使用角度模型和TextBoxFor和角度模型,TextBox应该显示服务器模型值。





提前致谢。

it shows "Other Name" in textbox.
Guys suggest me how to use angular model and TextBoxFor and angular model and TextBox should display server model value.


Thanks in advance.


这篇关于Angular模块会覆盖我的文本框以获取模型值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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