当Angular 1应用程序中的代码不同时,console.log始终打印相同的内容

时间:2017-09-11 20:43:35

标签: javascript angularjs console.log

我正在尝试完成此YouTube系列的Angular 1.5教程:Angular 1.5 tutorial。 Angular 1因为我的作品仍然使用它,我需要变得更好。

问题如下:我创建了一个blog-list.component.js和blog-list.module.js文件以及一个app.module.js文件。我在组件文件中写了一个基本上是console.log("hello sir");的console.log()消息,但之前我有console.log("hello");。现在,每当我尝试更改console.log消息时,它只会控制日志hello,而不是更新的控制台消息。我不确定我做错了什么,但我似乎无法找到我的错误。也许你可能会看到它?以下是文件内容:

博客-list.component.js:

'use strict';

angular.module('blogList').
  controller('BlogListController', function() {
    console.log("hello sir");
  }); 

博客-list.module.js:

'use strict';

angular.module('blogList', []);

app.module.js:

'use strict';

angular.module('try', ['blogList']);

index.html文件:

<!DOCTYPE html>
<html ng-app='try'>
  <head>
    <meta charset="utf-8">
    <title>Let's Build Angular!</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js" type="text/javascript"></script>

    <script src="./js/app/app.module.js"></script>
    <script src="./js/app/app.config.js"></script>

    <script src="./js/app/blog-list/blog-list.module.js"></script>
    <script src="./js/app/blog-list/blog-list.component.js"></script>
  </head>
  <body>
    <input type="text" ng-model='name'>
    <h2>This is going to be a working Angular Page for <span ng-if="name">{{ name }}</span><span ng-if="!name">WoRlD</span></h2>

    <div class='' ng-controller='BlogListController'>
    </div>
  </body>
</html>

我有一种感觉,错误是非常愚蠢的,但我无法看到它。非常感谢帮助!

1 个答案:

答案 0 :(得分:0)

更像是缓存问题,而不是任何东西, 您是否尝试打开Chrome开发者选项并点击网络 - &gt;禁用缓存 然后按ctrl + f5