Rob Kraft's Software Development Blog

Software Development Insights

Archive for November, 2014

How to Get the Simplest NG-Include from Angular to Work

Posted by robkraft on November 17, 2014

From the other examples I found online I thought it would be easy to start using ng-include in angularJS to pull in bits of HTML from other files, but after hours of struggle spread out over several days I found it was not.

Let me correct that.  It IS easy to do, you just have to be aware of some very important details.

  1. If you are attempting to do this on your local file system it will probably fail.  The example I have below is syntactically correct, but as of this writing in November of 2014 it only works on Firefox.  If you are using Chrome or IE you will only see the value of 3 in your output, not the contents of the included file.  I put the {{ 1 + 2 }} in the html to show that Angular was working, even when the ng-include is not.
  2. If you move your files into a hosted web server and access them through the web server they probably will work.
    1. But if you use IE and your browser uses compatibility mode to view the web server you are hosting the files on, it still does not work.  I think this is because Angular doesn’t support pre-IE8 browsers and compatibility mode is essentially rendering as IE7.

Here is the working code from my two files:

I name this file mypage.html

<!doctype html>
<html>
  <head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
  </head>
  <body ng-app>
 {{ 1 + 2 }}
    <div ng-include="'myinclude.html'"></div>
  </body>
</html>

Please be aware that you should surround your include name with single quotes which are encased in double quotes.

I name this file myinclude.html

My include is Showing!!!

Posted in Coding | Tagged: | Leave a Comment »

The AntiVirus Software from AVG is Itself a Virus

Posted by robkraft on November 8, 2014

I’ve been personally trying different anti-virus packages for Windows 8.1 and I must report deep disappointment with the free version of AVG anti-virus.  I have two complaints:

  1. When I apply an upgrade of the software it changes my browser homepage to their own URL.  I did not ask it to do this and did not even see any option where I could prevent it.  But the default behavior of an upgrade should not be to make changes that I don’t want to my computer.  That is the definition of a virus, software that changes my computers in ways I don’t like to benefit the writers of the software.
  2. The second problem I had was that my settings in the browser telling Internet Explorer 11 what to do when I open a new tab would not stick.  Every time I rebooted the computer they changed back to the default settings, a blank tab.  It took me a while to track down the cause and the cause was an addin that AVG Antivirus installed in my browser.  I don’t mind the addin, but I do mind that it kept changing my IE settings.

I guess it is time to try a different package.  Microsoft Essentials does not do anything unexpected and can be trusted, but it also has the reputation as being the poorest at catching viruses.

Posted in Home Tech, I.T. | Leave a Comment »