Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I have this little script and the controller in angular is completely empty so nothing there.

My question is why can't I run to ngIncludes (By the way no errors)?

<!DOCTYPE html>
<html ng-app="demo">
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height    attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<meta name="msapplication-tap-highlight" content="no" />

<script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="bower_components/angularjs/angular.min.js"></script>
</head>
<body>

<div ng-controller="main">
<ng-include src="'templates/android/header.html'" />
<ng-include src="'templates/android/newsfeed.html'" />
</div>
share|improve this question
1  
Can start by removing the single quotes on your "src"'s. – joeltine Aug 9 '14 at 9:53
    
That would not be a good idea, since that makes sure it is a string in the js parser. – user1645908 Aug 9 '14 at 9:55
    
Can you reproduce that issue in Fiddle/Planker? – Maxim Shoustin Aug 9 '14 at 9:57
    
And I would try: <div ng-include="templates/android/header.html'"></div> – Maxim Shoustin Aug 9 '14 at 9:58

I had same problem, but in my case I wasnt close the div tag properly:

<div ng-include="'partials/agendar.html'">
<div ng-include="'partials/atendimento.html'">

As I saw you do that, but you're using the 'ng-include' as tag. Try like this (worked perfectly for me). Be sure your angular is updated and then use only 'ng-include' (no 'data-'):

<div ng-include="'partials/agendar.html'"></div>
<div ng-include="'partials/atendimento.html'"></div>

Hope it helps.

share|improve this answer
    
Thanks for this. I had found an example with self-closing div tags like <div ng-include="'path.html'" />, but the second div would not show until I changed them to use separate closing tags: <div ng-include="'path.html'"></div> – Eric Hedstrom Dec 14 '14 at 19:29

I prefer valid HTML and suggest you:

<div data-ng-include="'templates/android/header.html'"></div>
<div data-ng-include="'templates/android/newsfeed.html'"></div>
share|improve this answer
    
Your example does not return any errors, but only returns the first include and then I am back to scratch. In general my issue is that I can't do more than one include (the next simply doesn't show up). Sorry if I wasn't exactly clear on that. – user1645908 Aug 9 '14 at 10:13

Can you start without src attribute like this:

if you give this type it doesn't show any error messages ngInclude the attribute binding so it doesn't show any error messages.

<data-ng-include="'templates/android/header.html'" />
<data-ng-include="'templates/android/newsfeed.html'" />

The correct way is this:

<div data-ng-include="'templates/android/header.html'"></div>
<div data-ng-include="'templates/android/newsfeed.html'"></div>
share|improve this answer
    
I just tried your example and it returned the first include. For the second one the following error: TypeError: Cannot read property 'insertBefore' of null – user1645908 Aug 9 '14 at 10:06
    
You don't use src attribute in ngInclude. ngInclude like as src attribute – parthicool05 Aug 9 '14 at 10:08
    
I just edited my own text, since I did stupid typo's. But It still write that error then. – user1645908 Aug 9 '14 at 10:10
    
Did You get the answer... – parthicool05 Aug 9 '14 at 10:19
    
No it still doesn't work If I am using it with W3 appliant syntax I will get the earlier mentioned error, if not it doesn't return any errors, but in both cases only show the first include. – user1645908 Aug 9 '14 at 10:24

Actually the question is not so clear for me but I tried like this and its work correct

 <body ng-controller="MainCtrl">
     <div ng-include src='"file1.html"'></div>
     <div ng-include src='"file2.html"'></div>
  </body>

Demo

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.