[問題] angular bind 中文出現亂碼

看板Ajax作者 ( )時間9年前 (2015/06/10 15:16), 9年前編輯推噓3(301)
留言4則, 3人參與, 最新討論串1/1
各位好,最近使用angularJS在學習開發Web頁面 今天一直卡在中文會出現亂碼 google一下跟找到的JS引起的錯誤好像不太一樣 方法都試過了,無法解決 不知道問題在哪裡,只好上來請教各位 使用eclipse ------------------------------------------------------------- index.html <!DOCTYPE html> <html ng-app="MainApp"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <head> </head> <body> <div ng-controller="MainCtrl as ctrl"> {{ctrl.test}} </div> </body> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.js" > </script> <script type="text/javascript" charset="UTF-8" src="app.js" ></script> </html ------------------------------------------------------------------ 在app.js angular.module('MainApp',[]) .controller('MainCtrl',[function(){ var self=this; self.test="中文字"; }]); ----------------------------------------------------------------- 結果會出現 ä¸- æ–‡å- — 有點像 ISO 8591-1 可是不太對 不知道應該怎麼辦 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.22.92.217 ※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1433920566.A.68E.html

06/10 15:39, , 1F
把ng-app擺在meta的後面,不然就乾脆拔掉
06/10 15:39, 1F
有試過把META拔掉,結果一樣

06/10 15:39, , 2F
我看官網上的範例是沒加的
06/10 15:39, 2F

06/10 20:49, , 3F
這兩個檔案有存成UTF-8嗎?
06/10 20:49, 3F
都確認過,都是utf-8沒錯 其實之後一直重新啟動SERVER之後,他又突然顯示中文了 完全不知道是什麼原因 ※ 編輯: sthermit (211.22.92.217), 06/11/2015 15:10:34

06/15 21:15, , 4F
可能browser的編碼設定跑掉了
06/15 21:15, 4F
文章代碼(AID): #1LT-GsQE (Ajax)