2016年6月6日 星期一

ng-mdel 輸入自動轉大寫

 .directive('uppercased', function() {
     return {
         require: 'ngModel',      
         link: function(scope, element, attrs, modelCtrl) {
             modelCtrl.$parsers.push(function(input) {
                 return input ? input.toUpperCase() : "";
             });
             element.css("text-transform","uppercase");
         }
     };
 })


input type="text" uppercased ng-model="id"

沒有留言:

批次檔正確處理中文

1. 確定檔案編碼為 UTF-8 2. 開頭先執行 chcp 65001