Urigo / meteor-angular-socially

angular-meteor example and tutorial app
https://www.angular-meteor.com/tutorials/socially/angular1/bootstrapping
155 stars 144 forks source link

Step 0: ng-include doesn't include the file (angular1) #123

Closed malaire closed 8 years ago

malaire commented 8 years ago

Step 0.9 with angular1 tells to add main.js in root folder but actual github commit adds it to client folder.

If I add main.js to client folder, there is nothing shown when I go to localhost:3000 If I add main.js to root folder, application crashes with "ReferenceError: window is not defined" error.

So neither option works.

OS is Debian 8.

EDIT: Forgot to mention that of course I did steps 0.10-0.11 also, and still no output.

malaire commented 8 years ago

step_00.zip also doesn't work. After unpacking and running 'meteor update' and 'meteor npm install --save angular angular-meteor' it starts, but also nothing is shown when I go to localhost:3000

malaire commented 8 years ago

Debugging further, if I add some AngularJS code to client/index.html like this:

<body ng-app="socially">
  <p>Hello {{ 'world' }}</p>
  <div ng-include src="'client/main.html'"></div>
</body>

The 'Hello world' is displayed but client/main.html is still not included.

malaire commented 8 years ago

Just noticed that I'm getting javascript error:

[angular-meteor][err][404] client/main.html - HTML template does not exists!

But that file definitely does exist.

nigelpasco commented 8 years ago

Is it this error?

Error: [angular-meteor][err][404] client/main.html - HTML template does not exists! You can disable this error by following this guide http://www.angular-meteor.com/api/1.3.11/templates ...

If so, this is because for one reason or another, the code is requiring Urigo's urigo:static-templates package right from the start (It did not use to be this way, but I noticed it last night when starting from scratch).

Adding the urigo:static-templates package seems to resolve the issue (it is done in the tutorial at step 3.16)

malaire commented 8 years ago

No, urigo:static-templates is for completely different use case ("component syntax" explained in step 3). That is not a solution for step 0 where "component syntax" hasn't been explained yet.

btw, the reason that works might be because when urigo:static-templates is added, angular-templates is removed, and in linked issue it is said that current angular-templates (1.0.5) is broken.

saanplus commented 8 years ago

i am also facing issue referencing the main.html template inside index.html using ng-include. However if use markup code of main.html within index.html it works fine. Somehow there is a problem in including ng-include. Wonder why. Here is a screenshot to the problem. http://prnt.sc/bv7z5p

jbriones1223 commented 8 years ago

I've been running into the same issue. I've done this tutorial once before, about 2 months ago, and it was working fine then. I guess an update ended up breaking something?

jdme commented 8 years ago

I had this problem and found the workaround! You should add the string import './main.html'; to main.js

kamilkisiela commented 8 years ago

Socially 1.0 has been updated to use angular-templates at version 1.0.8 which contains a fix for that issue.

The docs hasn't been yet deployed but the repository of Socially 1.0 is up to date.

To summarize, update angular-templates to the latest version to fix an issue with ng-include.

Feel free to @mention me or anyone from the team if this issue still occurs.