而不是这样做
<input type="checkbox" name="AltSchedule" ng-show="someVar" />
Run Code Online (Sandbox Code Playgroud)
我希望能够做到这一点
@Html.CheckBoxFor(model => model.AltSchedule, new {ng-show="someVar" })
Run Code Online (Sandbox Code Playgroud)
但我似乎无法找到使用带角度标签的html助手完成的答案.有没有办法为html帮助器的html属性参数添加角度标签?
尝试使用Unity.Mvc5和使用Identity 2.0和Identity 2.0 Samples样板的MVC 5应用程序配置Unity时,我得到以下异常.我已经阅读了这个SO 配置Unity DI的ASP.NET身份,我仍然不清楚我错过了什么.我在这做错了什么?
当前类型System.Data.Common.DbConnection是一个抽象类,无法构造.你错过了类型映射吗?
[ResolutionFailedException:依赖项的解析失败,type ="myApp.Web.Controllers.AccountController",name ="(none)".在解决时发生异常:
在例外时,容器是:
解析myApp.Web.Controllers.AccountController,(无)解析构造函数myApp.Web.Controllers.AccountController(myApp.Web.Models.ApplicationUserManager userManager)的参数"userManager"解析myApp.Web.Models.ApplicationUserManager,(无)解析参数构造函数myApp.Web.Models.ApplicationUserManager的"store"(Microsoft.AspNet.Identity.IUserStore 1[[myApp.Web.DAL.Profiles.ApplicationUser, myApp.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] store)
Resolving Microsoft.AspNet.Identity.EntityFramework.UserStore1 [myApp.Web.DAL.Profiles.ApplicationUser],(无)(从Microsoft.AspNet.Identity.IUserStore 1[myApp.Web.DAL.Profiles.ApplicationUser], (none))
Resolving parameter "context" of constructor Microsoft.AspNet.Identity.EntityFramework.UserStore1 [[myApp ]映射).Web.DAL.Profiles.ApplicationUser,myApp.Web,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null]](System.Data.Entity.DbContext context)Resolving System.Data.Entity.DbContext,(none)解析构造函数System.Data.Entity.DbContext的参数"existingConnection"(System.Data.Common.DbConnection existingConnection,System.Data.Entity.Infrastructure.DbCompiledModel model,System.Boolean contextOwnsConnection)Resolving System.Data.Common.DbConnection,(没有)
帐户控制器,因为我已修改它
public AccountController(ApplicationUserManager userManager)
{
_userManager = userManager;
}
private ApplicationUserManager _userManager;
Run Code Online (Sandbox Code Playgroud)
我已注册的容器
container.RegisterType<ApplicationUserManager>(new HierarchicalLifetimeManager());
container.RegisterType<IUserStore<ApplicationUser>, UserStore<ApplicationUser>>(new HierarchicalLifetimeManager());
Run Code Online (Sandbox Code Playgroud) asp.net-mvc dependency-injection unity-container asp.net-identity asp.net-identity-2
我无法安装Android开发工具.我克服了涉及GEF的一个错误.我现在有一个新错误.
缺少要求:Android开发工具0.9.6.v201002051504-24846(com.android.ide.eclipse.adt.feature.group 0.9.6.v201002051504-24846)需要'org.eclipse.wst.xml.ui 0.0.0'但它无法找到
我正在运行Kubuntu 9.10和Eclipse 3.5.我已设法安装Android DDMS.但是我一直在使用开发工具遇到障碍.我安装了Android SDK.
为了获得缺少的组件,我需要做什么?
我正在开发一个asp.net页面/应用程序.我创建了一个文本框,我使用jqueryui中的datepicker设置为日期选择器.在firefox和chrome中,datepicker不呈现.在IE9中,日期选择器呈现,如果我忽略错误.错误在jquery.ui.datepicker.js的第644行.
抛出错误的代码在这里.
inst.dpDiv.zIndex($(input).zIndex()+1);
这是VS在捕获错误时显示的消息
Microsoft JScript运行时错误:对象不支持此属性或方法
我不确定是什么导致了这个问题.我已经找到了zindex问题,我发现的那些与其他元素后面出现的对话有关.我没有发生这种情况.
我试图按照Brock Allen的例子来说明如何使用声明向Windows角色添加自定义角色.(http://brockallen.com/2013/01/17/adding-custom-roles-to-windows-roles-in -asp-net-using-claims /)目前,只是从他们的示例中插入代码我得到以下错误.我正在尝试使用仅添加了Microsoft.IdentityModel的干净的新MVC 5项目.我错过了什么会导致这个错误?
你调用的对象是空的.描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
异常详细信息:System.NullReferenceException:未将对象引用设置为对象的实例.
来源错误:
在执行当前Web请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息.
堆栈跟踪:
[NullReferenceException:对象引用未设置为对象的实例.]
System.Web.PipelineModuleStepContainer.GetStepArray(RequestNotification notification,Boolean isPostEvent)+22
System.Web.PipelineStepManager.ResumeSteps(异常错误)+1324
System.Web.HttpApplication. BeginProcessRequestNotification(HttpContext context,AsyncCallback cb)+95
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context)+186
这是我的global.asax.cs文件中的代码
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
PostAuthenticateRequest += WebApiApplication_PostAuthenticateRequest;
}
void WebApiApplication_PostAuthenticateRequest(object sender, EventArgs e)
{
if (Request.IsAuthenticated)
{
var id = ClaimsPrincipal.Current.Identities.First();
id.AddClaim(new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/gender", "potato"));
}
}
}
Run Code Online (Sandbox Code Playgroud) 当我将用户作为查询字符串传递(使用$ http中的参数)并设置web api方法以在uri中查找它们时,一切都很好.但是当我按照下面的方式传递它们时,用户显示为null.我在这里失踪了什么?
角度函数
scope.saveChanges = function () {
// create array of user id's
var users = [];
angular.forEach(scope.usersInRole, function (v, k) {
users.push(v.Key);
});
var data = { user: users };
var token = angular.element("input[name='__RequestVerificationToken']").val();
// put changes on server
http({
url: config.root + 'api/Roles/' + scope.selectedRole + '/Users',
method: 'PUT',
data: data,
contentType: "application/json; charset=utf-8",
headers: { "X-XSRF-Token": token },
xsrfCookieName: '__RequestVerificationToken'
}).success(function (result) {
// notify user changes were saved
angular.element('#myModal').reveal({ closeOnBackgroundClick: false });
});
}; …Run Code Online (Sandbox Code Playgroud)