小编nur*_*urp的帖子

如何使用angular-cli启用手表?

我不想使用服务,我知道它会监视变化,构建和服务.我希望以变化为基础.根据"ng help",build需要参数--watch

ng build构建您的应用程序并将其放入输出路径(默认情况下为dist).--watch(布尔值)(默认值:false)别名:-w --watcher(String)

我尝试了-w和-watcher,但它只是给出了错误.

>ng build -w

Path must be a string. Received null
Run Code Online (Sandbox Code Playgroud)

webpack angular-cli angular

33
推荐指数
3
解决办法
3万
查看次数

角度材质布局 - 对齐中心不会影响小模式下的文本

我希望这段代码能够纵向和横向集中内容.它就是这样,但是一旦我使窗口变小(移动尺寸),文本的(h1p)对齐就会变为左边.

我错过了非常基本的东西吗?我可以说它text-center有效,但我不想自己添加任何CSS样式.

angular.module('app', ['ngMdIcons', 'ngMaterial']);
Run Code Online (Sandbox Code Playgroud)
<html>
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.10.0/angular-material.min.css">
      <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=RobotoDraft:300,400,500,700,400italic">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
      <script src="https://login.persona.org/include.js"></script>
      <script src="https://code.angularjs.org/1.4.0/angular.js"></script>
      <script src="https://code.angularjs.org/1.4.0/angular-route.js"></script>
      <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular-animate.min.js"></script>
      <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular-aria.min.js"></script>
      <script src="https://ajax.googleapis.com/ajax/libs/angular_material/0.10.0/angular-material.min.js"></script>
      <script src="//cdnjs.cloudflare.com/ajax/libs/angular-material-icons/0.5.0/angular-material-icons.min.js"></script>
   </head>
   <body layout="column" ng-app="app">
      <div layout="row" flex layout-align="center center">
         <div layout="column" layout-align="center">
            <h1>Welcome to Dreamland!</h1>
            <md-button class="md-hue-2 md-raised md-primary" >
               <h1 class="md-display-1">Login</h1>
            </md-button>
            <p class="md-caption">This web site uses your membership with the given email address.</p>
         </div>
      </div>
   </body>
</html>
Run Code Online (Sandbox Code Playgroud)

html angularjs material-design angularjs-material

10
推荐指数
1
解决办法
2万
查看次数

将两个哈希值与混合类型进行比较

如果第二个哈希中的键值对相同​​,我想比较哈希值.我不想使用smartmatch,因为它会发出警告.

将两个哈希值与整数,字符串以及可能还有数组进行比较的最佳方法是什么?

use warnings;
use diagnostics;

my $hash1={"key_str"=>"a string", "key_int"=>4};
my $hash2={"key_str"=>"b string", "key_int"=>2};

foreach my $key ( keys(%$hash1) ) {
    if ($hash1->{$key} != $hash2->{$key}) {
        print($key);
    }
}
Run Code Online (Sandbox Code Playgroud)

预期的输出是:

Argument "b string" isn't numeric in numeric ne (!=) at hash_compare.pl line 8 (#1)
    (W numeric) The indicated string was fed as an argument to an operator
    that expected a numeric value instead.  If you're fortunate the message
    will identify which operator was so unfortunate.

Argument "a string" isn't numeric …
Run Code Online (Sandbox Code Playgroud)

perl hash

7
推荐指数
1
解决办法
619
查看次数