如何在@ html.actionlink中将ng-model值作为参数传递 [英] How to pass ng-model value as parameter in @html.actionlink
本文介绍了如何在@ html.actionlink中将ng-model值作为参数传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello Frnds,
当我要传递ng-model值时,我遇到问题(Ex
Hello Frnds,
I am facing problem when I am going to pass ng-model value (Ex
Date
-25-04 -2016)作为参数
-25-04-2016) as parameter to
@Html.ActionLink
。
.
<div class="col-md-2">
<label>Start Date </label>
<input type="text" ng-model="startdate" class="form-control disable-date-control" name="startdate" />
</div>
代码: - @ Html.ActionLink(Time Sheet,Index,Timesheet,new {date = startdate},null)。
当我选择取值挞日期,我想传递
<b>start Date</b>
作为@ Html.ActionLink的参数。
什么我试过了:
@ Html.ActionLink(时间表,索引,时间表,新{date =((DateTime) ViewBag.timesheetDate).ToString(dd-MM-yyyy)},null)
as parameter to @Html.ActionLink.
What I have tried:
@Html.ActionLink("Time Sheet", "Index", "Timesheet", new { date = ((DateTime)ViewBag.timesheetDate).ToString("dd-MM-yyyy") },null)
推荐答案
尝试使用角度观察 [ ^ ]
参考此
try using Angular Watch[^]
refer this
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="~/Scripts/jquery-1.8.2.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<input type="text" ng-model="startdate" class="form-control disable-date-control" name="startdate" />
@Html.ActionLink("Link name", "index", "Home", new { Date = "" }, new { id = "myLinkId" });
{{startdate}}
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function (
scope){
scope.startdate = 2016/02/08;
scope.startdate = "08/02/2016";
这篇关于如何在@ html.actionlink中将ng-model值作为参数传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文