简体   繁体   English

无法获得启动角度

[英]cant get angular to initiate

i was using plnkr to code the angular app im working on but when i try to code it locally everything angular seems to stop responding. 我正在使用plnkr编写我正在使用的角度应用程序的代码,但是当我尝试在本地对其进行编码时,所有角度似乎都停止响应。

heres my html : i tried using angulars cdn and linking the actual file but nothing works. 这是我的html:我尝试使用angulars CDN并链接实际文件,但没有任何效果。

 <!DOCTYPE html>
<html ng-app='store'>
  <head>
    <meta charset="utf-8">

  <script src="angular.min.js"></script>
</head>


<body>
   <div ng-controller="StoreController as store">
    <div ng-hide="store.product.soldOut">
      <h1> {{store.product.name}}</h1>
      <h2> ${{store.product.price}}</h2>
      <p> {{store.product.description}}</p>
     <input type="text" ng-model="yourName" placeholder="enter name">
     hello, {{yourName}}
      <button ng-show="store.product.canPurchase"> add to cart</button>
    </div>
  </div>

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

</body>
</html>

(function() { // code via app.js
  var app = angular.module('store', []);

  app.controller('StoreController', function() {
    this.product = gem;
  });

  var gem = {
    name: 'Dodecahedron',
    price: 2.95,
    description: '. . .',
    canPurchase: true,
    soldOut:true,
  };

})();

Make sure your call to the angular library resource is working -- or the path is correct. 确保您对角度库资源的调用正常工作-或路径正确。 Double check within your developer console. 在开发者控制台中仔细检查。 Below is a version via google CDN and simple implementation -- also check out the 'starting your app with angular tut' it's useful! 以下是通过Google CDN实现的版本和简单的实现-也请查看“使用角度启动启动应用程序”,它很有用! If you have errors in your console, update your question! 如果您的控制台有错误,请更新您的问题!

angular js on cdn: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> CDN上的angular js: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>

<!doctype html><!-- sample only -->
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
  </head>
  <body>
    <div>
      <input type="text" ng-model="yourName" placeholder="Enter a name here">
      <h1>Hello, {{ yourName }}!</h1>
    </div>
  </body>
</html>

Good tutorial . 很好的教程 <-- read <-阅读


Also, this could be just a problem initiating within your online IDE. 同样,这可能只是在在线IDE中启动时遇到的问题。 There is a guide to initiating within using JSfiddle .net so you may want to check out the rules or guide for doing with plnkr . 有一个引导到内使用的jsfiddle .NET所以你可能要检查出的规则或指导与plnkr做启动。

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

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