发表于: 2016-08-04 23:36:17
2 2332
- 今天完成的事情:增加表单验证
明天计划的事情:边做边熟悉angular
遇到的问题:ng-sumbit并没有找到合适的用法,很鸡肋的感觉。
收获:
ng-class三种用法.以前一直只使用第三种。
1:scope变量绑定(不推荐使用)


2:字符串数组形式。


3:对象key/value处理。
input[type="number"]取消上下箭头:
在chrome下:
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button{
-webkit-appearance: none !important;
margin: 0;
}
Firefox下:
input[type="number"]{-moz-appearance:textfield;}
编码格式:
在Form元素的语法中,EncType表明提交数据的格式 用 Enctype 属性指定将数据回发到服务器时浏览器使用的编码类型。
下边是说明:
application/x-www-form-urlencoded: 窗体数据被编码为名称/值对。这是标准的编码格式。
multipart/form-data: 窗体数据被编码为一条消息,页上的每个控件对应消息中的一个部分。 text/plain: 窗体数据以纯文本形式进行编码,其中不含任何控件或格式字符。
补充,
form的enctype属性为编码方式,常用有两种:application/x-www-form-urlencoded和multipart/form-data。
默认为application/x-www-form-urlencoded。 当action为get时候,浏览器用x-www-form-urlencoded的编码方式把form数据转换成一个字串(name1=value1&name2=value2...),然后把这个字串append到url后面,用?分割,加载这个新的url。 当action为post时候,浏览器把form数据封装到http body中,然后发送到server。 如果没有type=file的控件,用默认的application/x-www-form-urlencoded就可以了。 但是如果有type=file的话,就要用到multipart/form-data了。浏览器会把整个表单以控件为单位分割,并为每个部分加上Content-Disposition(form-data或者file),Content-Type(默认为text/plain),name(控件name)等信息,并加上分割符(boundary).
评论