我最近一直在寻找工作,并决定建立一个网站作为简历,同时学习AngularJS。我参加了CodeSchools Angular课程,慢慢地建立了这个网站,就像我想要的那样。 (请不要根据它现在的样子来判断它,但是想法是适用的)
现在到了代码问题!
网站: http://danieboy.github.io/
Index.html(开始,简历,评论和联系工作 - myprojects don&#t; )
<div class="content-wrap">
<section id="section-shape-1">
<start></start>
</section>
<section id="section-shape-2">
<resume></resume>
</section>
<section id="section-shape-3">
<myprojects></myprojects>
</section>
<section id="section-shape-4">
<reviews></reviews>
</section>
<section id="section-shape-5">
<contact></contact>
</section>
</div>
myDirectives.js
var app = angular.module('blog-directives', []);
app.directive("start", function() {
return {
restrict: "E",
templateUrl: "start.html"
}
});
app.directive("resume", function() {
return {
restrict: "E",
templateUrl: "resume.html"
}
});
app.directive("myprojects", function() {
return {
restrict: "E",
templateUrl: "myprojects.html"
}
});
app.directive("reviews", function() {
return {
restrict: "E",
templateUrl: "reviews.html"
}
});
app.directive("contact", function() {
return {
restrict: "E",
templateUrl: "contact.html"
}
});
start.html (工作)
<h1>
<a id="welcome-to-my-developer-blog" class="anchor" href="#welcome-to-my-developer-blog" aria-hidden="true"><span class="octicon octicon-link"></span></a>Welcome to my developer blog!</h1>
*Text...*
<img src="images/Web-under-construction.jpeg" alt="Under Construction"></br>
myprojects.html (不工作)
<h3><a href="http://danieboy.github.io/hotorcold"> Hot or Cold</a></h3>
<h3><a href="http://danieboy.github.io/flatlander-store/index.html"> Flatlander Store Project</a></h3>
<h3><a href="http://danieboy.github.io/bmi-calculator/index.html"> Android Application: BMI-counter</a></h3>
<h3><a href="http://www.markettime.se/"> Markettime through Diflex AB (Swedish)</a></h3>
<h3><a href="http://test2.markettools.se"> Markettools through Diflex AB (Swedish)</a></h3>
我真的不知道为什么其中四个会起作用而不是第五个。
我首先使用名称MyProjects而不是myprojects意外创建了文件并将其删除,但我可能错误地没有交叉安全删除,因为我认为自从我创建以来它并不重要同样的文件。这可能是个问题吗?在自动更新的.idea / workspace.xml文件中(我使用WebStorm 10.1)
提前致谢:)
答案 0 :(得分:2)
它在Chrome控制台中显示以下堆栈跟踪:
Error: [$compile:tpload] Failed to load template: myprojects.html
http://errors.angularjs.org/1.2.15/$compile/tpload?p0=myprojects.html
at angular.js:78
at angular.js:6576
at angular.js:7740
at deferred.promise.then.wrappedErrback (angular.js:11109)
at deferred.promise.then.wrappedErrback (angular.js:11109)
at deferred.promise.then.wrappedErrback (angular.js:11109)
at angular.js:11242
at Scope.$get.Scope.$eval (angular.js:12175)
at Scope.$get.Scope.$digest (angular.js:12004)
at Scope.$get.Scope.$apply (angular.js:12279)
所以你可能只是放错了你的myprojects.html。
当我导航到http://danieboy.github.io/myprojects.html时,它会显示404,所以这确认了这就是问题所在。