简体   繁体   English

AngularJS模板未在本地加载,但将在Plnkr中加载

[英]AngularJS template not loading locally, but will load in Plnkr

I'm trying to get a proof of concept going locally with this plnkr: 我正在尝试使用plnkr在本地进行概念验证:

http://plnkr.co/edit/at8SXmvb2LkWYtuZE9Vm?p=preview http://plnkr.co/edit/at8SXmvb2LkWYtuZE9Vm?p=预览

Everything works fine in plnkr, but when I download the zip, and run a simple Node server, the templates won't load up at http://localhost:8080 . 在plnkr中一切正常,但是当我下载zip并运行简单的Node服务器时,模板不会在http:// localhost:8080加载。 All I get is the tab title, but not the content inside of the template. 我得到的只是标签标题,而不是模板内部的内容。 There are no errors in the console either, so I'm wondering what's wrong? 控制台中也没有错误,所以我想知道怎么了?

Any help would be really appreciated! 任何帮助将非常感激!

Here's what the controller looks like: 控制器的外观如下:

.controller('TabsCtrl', ['$scope', function($scope) {
    $scope.tabs = [{
      title: 'One',
      url: 'one.html'
    }, {
      title: 'Two',
      url: 'two.html'
    }, {
      title: 'Three',
      url: 'three.html'
    }];

    $scope.currentTab = 'one.html';

    $scope.onClickTab = function(tab) {
      $scope.currentTab = tab.url;
    }

    $scope.isActiveTab = function(tabUrl) {
      return tabUrl == $scope.currentTab;
    }
  }]);

Looks like I wasn't putting my HTML templates in the proper format. 好像我没有以正确的格式放置HTML模板。 Instead of just adding <h1>Hello World</h1>, I needed to also include the <html> and <body> tags. 我不仅需要添加<h1>Hello World</h1>,还需要包含<html><body>标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM