小编Joe*_*Joe的帖子

当项目使用grunt构建时,Fontawesome无法正常工作

我正在使用字体库字体真棒.当项目没有使用grunt构建/使用时,它可以工作.

但是,当我用咕噜声构建项目时,它无法正常工作.我在控制台中收到此错误:.../fonts/fontawesome-webfont.woff?v = 4.0.3 404(未找到)

我和自耕农一起搭建了这个项目.

这是我在index.html中的参考

    <!-- build:css styles/fontawesome.css -->
    <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
    <!-- endbuild -->
Run Code Online (Sandbox Code Playgroud)

什么想法可能是错的?

更新 我需要将文件夹/ bower_components/font-awesome/fonts复制到dist/fonts.这需要在grunt文件中完成.可能在"复制"选项下

copy: {
  dist: {
    files: [{
      expand: true,
      dot: true,
      cwd: '<%= yeoman.app %>',
      dest: '<%= yeoman.dist %>',
      src: [
        '*.{ico,png,txt}',
        '.htaccess',
        'bower_components/**/*',
        'images/{,*/}*.{gif,webp}',
        'styles/fonts/*'
      ]
    }, {
      expand: true,
      cwd: '.tmp/images',
      dest: '<%= yeoman.dist %>/images',
      src: [
        'generated/*'
      ]
    }]
  },
Run Code Online (Sandbox Code Playgroud)

但我不确定在哪里包括这个.

angularjs gruntjs font-awesome yeoman

64
推荐指数
4
解决办法
5万
查看次数

UI路由器干扰$ httpbackend单元测试,角度js

这是一个具有提交功能的控制器:

$scope.submit = function(){   

 $http.post('/api/project', $scope.project)
      .success(function(data, status){
        $modalInstance.dismiss(true);
      })
      .error(function(data){
        console.log(data);
      })
  }
}
Run Code Online (Sandbox Code Playgroud)

这是我的考验

it('should make a post to /api/project on submit and close the modal on success', function() {
    scope.submit();

    $httpBackend.expectPOST('/api/project').respond(200, 'test');

    $httpBackend.flush();

    expect(modalInstance.dismiss).toHaveBeenCalledWith(true);
  });
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

Error: Unexpected request: GET views/appBar.html
Run Code Online (Sandbox Code Playgroud)

views/appBar.html是我的templateUrl:

 .state('project', {
    url: '/',
    templateUrl:'views/appBar.html',
    controller: 'ProjectsCtrl'
  })
Run Code Online (Sandbox Code Playgroud)

所以不知何故,ui-router正在使我的$ httpBackend指向此而不是我的提交功能.在使用$ httpBackend的所有测试中,我遇到了同样的问题.

这有什么解决方案吗?

javascript angularjs angular-ui karma-runner angular-ui-router

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

链接和图标之间的空间,fontawesome

在链接/段落和图标之间获得空格的最佳方法是什么?

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<a href="#/upgrade/selection"><i class="fa fa-reply"></i>Change</a>
Run Code Online (Sandbox Code Playgroud)

在文本之前放置一个空格是不行的,因为当你缩小/ uglify项目时它会被更改回来.

我试过各种填充和边距.不能让他们分开.

html css font-awesome

40
推荐指数
6
解决办法
6万
查看次数

关闭动画,模态,角度ui

是否可以在angular-ui中关闭模态指令的动画?http://angular-ui.github.io/bootstrap/

在选项中找不到任何内容.我应该修改源吗?或者,当您想要自定义时,是否有最佳实践?

angular-ui angular-ui-bootstrap

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

Postgresql Windows,是否有默认密码?

刚刚在Windows 7上安装了Postgresql.我没有被要求在安装过程中设置密码.当我运行psql时,我被要求输入密码.用Google搜索,唯一可能的默认密码是"postgre".但那没用.还尝试了一个空密码和我的Windows密码.他们都没有工作.阅读一些高级的东西如何重置密码,但这不可能是正确的?我在这里错过了什么?我想输入什么密码?

windows postgresql

29
推荐指数
1
解决办法
9万
查看次数

过滤掉具有空值的数组,下划线

我有这个数组:

[null, {name:'John'}, null, {name:'Jane'}]
Run Code Online (Sandbox Code Playgroud)

我想删除空值.使用下划线有一种简单的方法吗?

javascript underscore.js

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

在jshint中使用下划线

我正在使用下划线库.

我在运行jshint时得到这个:

[L38:C38] W117: '_' is not defined.
      var approvedAndRequstedCount = _.countBy(products, function(obj) {
Run Code Online (Sandbox Code Playgroud)

警告:任务"jshint:all"失败.使用--force继续.

这是我的配置文件:

{
  "node": true,
  "browser": true,
  "esnext": true,
  "bitwise": true,
  "camelcase": false,
  "curly": true,
  "eqeqeq": true,
  "immed": true,
  "indent": 2,
  "latedef": true,
  "newcap": true,
  "noarg": true,
  "quotmark": "single",
  "regexp": true,
  "undef": true,
  "unused": true,
  "strict": true,
  "trailing": true,
  "smarttabs": true,
  "globals": {
    "angular": false
  }
}
Run Code Online (Sandbox Code Playgroud)

我猜这是全局选项的东西?我试图添加"_":假但没有运气.有任何想法吗?

javascript jshint angularjs

24
推荐指数
1
解决办法
6585
查看次数

使用Highcharts调整高度

我有一个Highchart,当窗口改变大小时,它会大大调整宽度.但不是高度.我试过这个设定的图表大小,但它不能正常工作.当窗口改变大小时,有没有其他方法可以自动更改高度?

这是我输出的css代码.我有一个Jquery UI选项卡,另一个选项卡显示数据表

#output-container
{
    float: right;
    display: inline;
    position: absolute;
    right: 10px; 
    left: 400px;
    top:120px;
    overflow-y: auto;
}
Run Code Online (Sandbox Code Playgroud)

这是我对chartdiv的css:

#chartContainer{
    margin: auto;
}
Run Code Online (Sandbox Code Playgroud)

这是js Chart函数:

function qchart(){
    chart = new Highcharts.Chart({
        chart: {
            renderTo: 'chartContainer',
            type: 'column',
            spacingBottom: 3,
            //height: (screen.availHeight)-500,
            marginRight: 30,
            marginBottom: 30,
            reflow: true
        },
        //etc..
    };
    //...
}
Run Code Online (Sandbox Code Playgroud)

css jquery highcharts

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

Angular-ui模态,从$ http发送数据到模态控制器

我正在使用angular-ui模态指令http://angular-ui.github.io/bootstrap/.

我已经按照上面的链接示例.

这是我想从控制器发送的数据:

ProductsFactory.getOneProduct().then(function(d){
  $scope.selectedProduct = d.data;
});

$scope.open = function () {
  var modalInstance = $modal.open({
    controller: 'ModalInstanceCtrl',
    templateUrl: 'productDetail.html',
    resolve: {
      items: function () {
        return $scope.selectedProduct;
      }
    }
  });
};
Run Code Online (Sandbox Code Playgroud)

这是我的模态控制器:

var ModalInstanceCtrl = function ($scope, $modalInstance, selectedProduct) {

  console.log(selectedProduct);

  $scope.ok = function () {
    $modalInstance.close();
  };

  $scope.cancel = function () {
    $modalInstance.dismiss('cancel');
  };
};
Run Code Online (Sandbox Code Playgroud)

问题是我无法访问我的模态控制器中的"选定产品".我知道原因是做宽度异步调用,它只能从GUI访问.但是我该如何解决这个问题呢?如何将"$ scope.selectedProduct"发送到我的ModalInstanceCtrl?

angularjs angular-ui

19
推荐指数
1
解决办法
6万
查看次数

XML解析检查属性是否存在

我已经创建了一个方法来检查XML文件中是否存在属性.如果它不存在则返回"False".它可以工作,但解析文件需要很长时间.它似乎读取每一行的整个文件.我错过了什么吗?我可以以某种方式使它更有效吗?

    public static IEnumerable<RowData> getXML(string XMLpath)
    {
        XDocument xmlDoc = XDocument.Load("spec.xml");

        var specs = from spec in xmlDoc.Descendants("spec")
                    select new RowData
                    {
                        number= (string)spec.Attribute("nbr"),
                        name= (string)spec.Attribute("name").Value,
                        code = (string)spec.Attribute("code").Value,
                        descr = (string)spec.Attribute("descr").Value,
                        countObject = checkXMLcount(spec),


        return specs;
    }

    public static string checkXMLcount(XElement x)
    {
        Console.WriteLine(x.Attribute("nbr").Value);
        Console.ReadLine();
        try
        {
            if (x.Attribute("mep_count").Value == null)
            {
                return "False";
            }
            else
            {
                return x.Attribute("mep_count").Value;
            }
        }
        catch
        {
            return "False";
        }
    }
Run Code Online (Sandbox Code Playgroud)

我测试用一个只返回和接收字符串的方法替换方法:

public static string checkXMLcount(string x)
{
    Console.WriteLine(x);
    Console.ReadLine();
    return x;

} …
Run Code Online (Sandbox Code Playgroud)

c# xml linq linq-to-xml

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