我最近一直在寻找工作,并决定建立一个网站作为简历,同时学习AngularJS。我上了CodeSchools Angular课程,然后按照自己的意愿缓慢地构建了这个网站。 (请不要根据现在的外观来判断它,但会想出一些主意)

现在到代码问题了!

网站:
http://danieboy.github.io/

Index.html(开始,恢复,评论和联系工作,而myprojects不这样做)

<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)

提前致谢 :)

最佳答案

它在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,因此可以确认这是问题所在。

09-30 10:53