Wisdom of Jim
  • Blog
  • About Jim

A place to obtain the wisdom of Jim.

Use Double Quotes for ng-include File Paths

3/19/2016

Comments

 
Today I couldn't figure out why my <ng-include> tags were not working. It didn't give me an error. It would just fail silently. I was putting it in just single quotes when really the files path should be wrapped in both single quotes and double quotes. So the correct way would be like this:
<div ng-include="'test.html'"></div>
or
<ng-include src="'test.html'"></ng-include>
test.html can be any snippet of html, and can refer to the controller containing this ng-include tag by it's Controller as value. Ng-include is a simple way of breaking up html. If you want to assign your html snippet it's own controller, consider making it a custom directive instead.
Comments
comments powered by Disqus

    ​Author

    Picture
    The posts on this site are written and maintained by Jim Lynch. About Jim...

    Categories

    All
    Actionscript 3
    Angular
    AngularJS
    Automated Testing
    AWS Lambda
    Behavior-driven-development
    Blogging
    Business Building
    C#
    C / C++
    ClojureScript / Clojure
    Coding
    Community Service
    CS Philosophy
    Css / Scss
    Dev Ops
    Firebase
    Fitness
    Flash
    Front End
    Functional Programming
    Git
    Go Lang
    Illustrations
    Java
    Javascript
    Lean
    Life
    Logic Pro
    Music
    Node.js
    Planning
    Productivity
    Professionalism
    Python
    React
    Redux / Ngrx
    Refactoring
    Reusable Components
    Serverless
    Shell Scripting
    Swift
    Test Driven Development
    TypeScript
    Useful Sites
    Useful Tools
    Video
    Website Development
    WebStorm
    Writing

    Archives

    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015

    RSS Feed

  • Blog
  • About Jim

WoJ © 2015 - 2016