我正在使用input type ="file",现在我的要求是我只想选择png图像,也就是当我选择浏览时应该应用"png"过滤器.
我已经提及www.w3schools.com/tags/att_input_accept.asp
以下是我正在使用的代码,这适用于Chrome,但不适用于Firefox和IE.
请任何人帮助我理解我必须做的错误吗?
<h2>Below uses accept="image/*"</h2>
<input type="file" name="pic1" accept="image/*" />
<h2>Below I need to accept only for png</h2>
<input type="file" name="pic1" accept="image/png" />
Run Code Online (Sandbox Code Playgroud)
这是一个小提琴链接http://jsfiddle.net/Jcgja/2/
我正在使用Angular进行表单验证.
这是我使用的 - plunker-edit我从Angularjs文档中获取了这些代码 - 绑定到窗体和控件状态已经使用了类型,email
但是当我运行它并输入abc@abc
它时说它是有效的.我该如何解决 ?
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example100-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.8/angular.min.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="">
<div ng-controller="Controller">
<form name="form" class="css-form" novalidate>
E-mail:
<input type="email" ng-model="user.email" name="uEmail" required/><br />
<div ng-show="form.uEmail.$dirty && form.uEmail.$invalid">Invalid:
<span ng-show="form.uEmail.$error.required">Tell us your email.</span>
<span ng-show="form.uEmail.$error.email">This is not a valid email.</span>
</div>
</form>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
PS:我是AngularJs的初学者
编辑:
此外,以下输入也显示有效
预期的有效电子邮件
我正在搜索ASP.NET MVC 3/4的响应模板,可以将其用作基础,然后根据需要进行扩展.
谷歌搜索了一段时间后,我遇到了这两个选项.
Twitter Bootstrap - 从未使用它,但看起来很有前景
是否有人知道可以与ASP.NET MVC网站一起使用的更多/兼容/更好的响应模板?
如果他们有一个响应式模板,这肯定会让所有MVC开发人员的生活更轻松.谢谢.
我试图将依赖注入我的中间件构造函数,如下所示
public class CreateCompanyMiddleware
{
private readonly RequestDelegate _next;
private readonly UserManager<ApplicationUser> _userManager;
public CreateCompanyMiddleware(RequestDelegate next
, UserManager<ApplicationUser> userManager
)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
await _next.Invoke(context);
}
}
Run Code Online (Sandbox Code Playgroud)
我的Startup.cs文件看起来像
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseMySql(Configuration.GetConnectionString("IdentityConnection")));
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
...
app.UseMiddleware<CreateCompanyMiddleware>();
...
Run Code Online (Sandbox Code Playgroud)
但是我收到了这个错误
启动应用程序时发生错误.InvalidOperationException:无法从根提供程序解析作用域服务'Microsoft.AspNetCore.Identity.UserManager`1 [Common.Models.ApplicationUser]'.Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateResolution(类型serviceType,IServiceScope范围,IServiceScope rootScope)
我正在使用ASP.NET Web Api来公开一些GET方法.
但是在我返回数据之前,我需要将一些细节记录到数据库中,其中很少有如下所示:
现在我在控制器中执行此操作时,我曾使用以下代码,
var ipAddress = Request.ServerVariables["REMOTE_ADDR"];
var userAgent = Request.UserAgent;
Run Code Online (Sandbox Code Playgroud)
但是在Web API中我无法使用它.
任何人都可以帮我解决这个问题.
我正在开发一个项目,并且在所有客户端操作上都非常依赖web api,无论是帐户详细信息更新,添加了新的详细信息,还是使用ASP.NET Web Api和Backbone.js修改了所有内容.
当前场景:
在当前的方案中,我从web api控制器返回一个布尔值,以指示操作是否成功.
示例:
[ActionName("UpdateAccountDetails")]
public bool PostAccountDetails(SomeModel model)
{
bool updateStatus = _customService.UpdateAccountDetails(model);
return updateStatus;
}
Run Code Online (Sandbox Code Playgroud)
所以在对此操作进行ajax调用后,我检查响应是否为true/false并显示错误或成功消息.
问题:
现在发生的事情是我开始在我的操作中获得异常,并且操作保持返回false,并显示错误消息.但我无法找到原因?
所以我想知道是否有一个标准的api响应结构,每个人都遵循?
我最初提出这个想法让每个web api动作返回这个类
public class OperationStatus
{
public bool Result { get; set; } // true/false
public string Status { get; set; } // success/failure/warning
public List<string> WarningMessages { get; set; }
public List<string> ErrorMessages { get; set; }
public string OtherDetails { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
这种变化将是一个重大变化,耗费时间和资源,所以我认为最好对此有第二/第三/第四意见.
请对此有所了解.
更新:
[ActionName("UpdateAccountDetails")] …
Run Code Online (Sandbox Code Playgroud) 我有一个带有名为"map_id"的整数列的表,我想添加一个activeadmin过滤器来过滤此列是否为NULL或IS NOT NULL.
怎么能实现呢?
我尝试了以下过滤器
filter :map_id, :label => 'Assigned', :as => :select, :collection => {:true => nil, :false => ''}
Run Code Online (Sandbox Code Playgroud)
但是,我收到以下错误消息:
用于#的未定义方法`map_eq'
我刚刚在Windows 8机器上安装了Visual Studio 2012 Express Edition.
现在我想安装Windows 8 Phone的SDK,我知道可以从这里下载:http://dev.windowsphone.com/en-us/downloadsdk
但是这个链接只下载一个设置,然后下载文件,我想知道是否有任何完整的sdk下载,我可以下载和使用.
我打算使用我的办公室连接下载这些文件,然后将其安装在我的家用电脑上.
有什么想法吗 ?
我已经按照他们的文档在 Amplify 控制台上部署了 React 应用程序。该站点已部署并运行良好,我可以使用链接进行导航,但是当我尝试直接登陆任何 url 时,我被重定向到我配置的 404 页面。
下面是我正在使用的代码
ReactDOM.render(
<Router>
<Route path="/" component={App} />
</Router>,
document.getElementById("root"),
);
Run Code Online (Sandbox Code Playgroud)
这是我的路线的样子 -
<Switch>
<Route
exact
path="/"
render={(): JSX.Element => <Home auth={this.auth} />}
/>
<Route path="/features" render={(): JSX.Element => <Features />} />
<Route
path="/pagenotfound"
render={(): JSX.Element => <PageNotFound />}
/>
<Redirect from="/**" to="/pagenotfound" />
</Switch>
Run Code Online (Sandbox Code Playgroud)
这是应用程序的链接 - https://master.dkf0zemoh330o.amplifyapp.com/features
我正在开发一个简单的类库项目,它将给我一个DLL.
我想从配置文件中读取特定值.所以我在我的项目中添加了一个App.config文件.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="serviceUrl" value="test value" />
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
上面是我的App.config文件,现在我正在尝试将其读取如下
string strVal = System.Configuration.ConfigurationManager.AppSettings["serviceUrl"];
Run Code Online (Sandbox Code Playgroud)
但是我的字符串变量没有任何值.
我以类似的方式为Web应用程序完成了这项工作.但不知怎的,我无法让这个工作.
是否首先在类库项目中使用App.config是正确的?
asp.net-mvc ×2
c# ×2
.net ×1
activeadmin ×1
angularjs ×1
app-config ×1
asp.net-core ×1
aws-amplify ×1
css3 ×1
formtastic ×1
html ×1
html5 ×1
input ×1
meta-search ×1
windows-8 ×1