<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>tuoxiaozhong (tuoxiaozhong)</title>
    <link>https://ruby-china.org/tuoxiaozhong</link>
    <description>编程=修行</description>
    <language>en-us</language>
    <item>
      <title>Angular 一小坑  Error: error:modulerr  Module Error</title>
      <description>&lt;p&gt;使用 angular 的时候有个小问题，调试了好久，提出来，希望有和我一样刚开始学 angular 的小伙伴能搜到然后提醒你解决掉。&lt;/p&gt;

&lt;p&gt;错误：&lt;/p&gt;
&lt;pre class="highlight erb"&gt;&lt;code&gt;Error: error:modulerr 
Module Error
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;在开发环境下没有问题，在生产环境下报错。&lt;/p&gt;

&lt;p&gt;错误产生的原因：
1、代码写错了，不可能，开发环境下面都可以哒；
2、代码写错了，怎么会编译后就报错，我得把编译后的代码挖出来看看是个什么鬼；
3、还是代码写错了，这样写真的健壮么，去仔细看看文档吧。
当然，这可能不是你的问题，它可能来自于蛋疼的生产环境下的压缩机制。&lt;/p&gt;

&lt;p&gt;Rails 在生产环境下默认的 uglifier 压缩方式替换了 js 代码里面的变量，angular 读不到$scope,$http 这样的变量了，而被压缩成了 t,a,b,c,d，鬼才知道这些变量是干嘛的。
至于其他压缩方式压缩出来是什么东西我就不清楚了，有兴趣的话可以尝试一下。
还好 angular 有$injector 这个东西，至于具体是什么，我也不想深挖了。为了保证你的代码不被替换，最好直接写成这样：&lt;/p&gt;
&lt;pre class="highlight coffeescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;controller&lt;/span&gt; &lt;span class="s"&gt;'NavActiveController'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'$scope'&lt;/span&gt;&lt;span class="p"&gt;,(&lt;/span&gt;&lt;span class="nx"&gt;$scope&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
  &lt;span class="nx"&gt;$scope&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;href&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;我的理解是用字符串去再次去替换变量，或者说是引导 angular 这个聪明的框架调用你想用的 module，妈妈再也不用担心我的变量被无情的替换了。不得不爱。&lt;/p&gt;

&lt;p&gt;所以以后玩儿 controller 的时候要注意 function 里面的变量的写法咯，下面这篇文章有详细的解释&lt;/p&gt;

&lt;p&gt;&lt;a href="http://thegreenpizza.github.io/2013/05/25/building-minification-safe-angular.js-applications/" rel="nofollow" target="_blank"&gt;http://thegreenpizza.github.io/2013/05/25/building-minification-safe-angular.js-applications/&lt;/a&gt;&lt;/p&gt;</description>
      <author>tuoxiaozhong</author>
      <pubDate>Wed, 04 Feb 2015 11:33:24 +0800</pubDate>
      <link>https://ruby-china.org/topics/24112</link>
      <guid>https://ruby-china.org/topics/24112</guid>
    </item>
    <item>
      <title>node-webkit 一个坑</title>
      <description>&lt;p&gt;之前用 node-webkit 做客户端，打包 windows 应用程序的时候在某些标签下面中文不显示，目测不是编码的问题，因为里面是被占格了甚至可以复制粘贴出来，更奇怪的是，在调试窗口里面也是这样，百思不得其解。&lt;/p&gt;

&lt;p&gt;最后的最后，我把字体加粗了，居然就显示出来了。可是问题来了，满屏的粗体怎么破。希望前端大咖给出一个更好的解决办法，THKS.&lt;/p&gt;</description>
      <author>tuoxiaozhong</author>
      <pubDate>Thu, 15 Jan 2015 10:13:54 +0800</pubDate>
      <link>https://ruby-china.org/topics/23750</link>
      <guid>https://ruby-china.org/topics/23750</guid>
    </item>
    <item>
      <title>关于 bootstrap 的 IE 兼容问题</title>
      <description>&lt;p&gt;我加了 html5shiv 和 response.js，样式没什么问题了。但是顶部的响应式导航会认为 IE 浏览器是移动设备，总之就把页面压缩了，应该怎么解决呀。&lt;/p&gt;

&lt;p&gt;比如大家访问这个站&lt;a href="http://www.ghostchina.com/" rel="nofollow" target="_blank"&gt;http://www.ghostchina.com/&lt;/a&gt;&lt;/p&gt;</description>
      <author>tuoxiaozhong</author>
      <pubDate>Fri, 07 Nov 2014 15:47:51 +0800</pubDate>
      <link>https://ruby-china.org/topics/22548</link>
      <guid>https://ruby-china.org/topics/22548</guid>
    </item>
  </channel>
</rss>
