草庐IT

ng-style

全部标签

javascript - Angular2 ng2-图表自定义?

我已经开始使用angular2ng2-chart。对于我使用angular2ng2-chart创建的下图,我有几个问题,但仍想进行更多自定义:问题:1)当没有像上图Nov-7中那样的值为0(零)的值时,如何在两点之间画一条虚线?2)如何制作阴影效果、不透明度或多种颜色的组合?3)当我将鼠标悬停在任何定义的点上时以及如果我想在鼠标悬停时更改y轴网格颜色时如何获取y轴的值。使用ng2-chart悬停功能的最佳方法是什么?当前示例代码和配置文件:index.htmlOverviewindex.component.tsimport{Component,Output,EventEmitter,O

javascript - Nextjs React SSR with styled-jsx - 无法读取未定义的属性 'state'

我偶然发现了一个我似乎无法解决的问题。我试图在这里搜索解决方案,但无法帮助自己。我是javascript的新手,所以要考虑周到。问题:我将React(16.5.0)与nextjs(6.1.2)和styled-jsx一起使用,如下所示:importReact,{Component}from'react';importPropTypesfrom'prop-types';importLinkfrom'next/link';classProductCardextendsComponent{constructor(props){super(props);this.state={imgLoaded

javascript - 在 JavaScript 中限制对 'style' 属性的访问

我开始开发一个小型JavaScript库,我想只通过我的API来设置HTML元素的样式(因为出于某种原因我需要完全控制样式)。所以我想让style属性不可访问(我的API将通过我的style别名访问它-这不是一个理想的解决方案,但对于像jQuery这样的其他库来说它可以技巧)。如果我这样写(受thistopic启发):varbox=document.getElementById('someElementId');Object.defineProperty(box,'style',{get:function(){throw'youcantaccessstyleproperty';}});

javascript - Angular ng-repeat 实现

我尝试实现Angularng-repeat指令,但我不明白为什么这段代码不能正常工作。.directive("myRepeat",function(){return{transclude:"element",priority:1000,compile:function(tElem,tAttrs){varmyLoop=tAttrs.myRepeat,match=myLoop.match(/^\s*(.+)+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/),indexString=match[1],collectionString=match[2],pa

javascript - Angular : ng-if and ng-repeat not working after custom transclusion

我正在尝试在angularJS中对指令进行自定义嵌入,因为我需要将两个单独的元素嵌入到两个单独的位置。问题是,虽然一些指令在嵌入的内容上继续工作,例如ng-bind其他指令,例如ng-if或ng-repeat不要这样做,即使在使用正确的范围重新编译被嵌入的元素之后也是如此。示例:http://jsbin.com/menakapoma/1/edit?html,js,output正如您在示例中看到的那样,ng-bind有效,但ng-if无效,即使它们都在同一范围内并访问相同的值.ng-if的true或false状态都不起作用。我相信这是因为ng-if指令被嵌入为注释,但是即使我将嵌入指令的

javascript - grunt-ng-constant 目标不能持续工作

我在grunt-ng-constant中遇到了一个奇怪的问题,其中3个目标中只有2个有效。我的配置如下所示:grunt.initConfig({ngconstant:{options:{space:'',wrap:'"usestrict";\n\n{%=__ngModule%}',name:'config'},//Environmenttargetsdevelopment:{options:{dest:'/scripts/config.js',},constants:{ENV:{name:'development',apiEndpoint:'http://your-developmen

javascript - AngularJS - 如何处理 ng-repeat 与预先存在的项目

我正在尝试将ng-repeat用于列表。但我想要使用Django呈现的预先存在的列表项。注意:我已将{[{}]}设置为我的AngularJSInterpolateProvider。HTML示例{%foriteminexisting_list%}{{item.firstName}}{{item.lastName}}{%endfor%}{[{item.firstName}]}{[{item.lastName}]}现在,我想使用ng-controller处理这些项目app.jsfunctionListController($scope){$scope.items=[{firstName:"B

javascript - AngularJS 选择 ng-change 函数找不到选定的模型

我在处理一些基本的Angular数据绑定(bind)时遇到了问题。我的看法:AllPersons我的Controller:$scope.testdataset=[{name:"bill"},{name:"bob"},{name:"batman"}];$scope.personChanged=function(person){console.log(person);}效果很好——选择的名称已记录。Butthissimplyprints"undefined"whenanameisselected查看:AllPersonsController:$scope.testdataset=[{nam

javascript - $digest 渲染 ng-repeat 作为注释

我正在为指令编写测试,执行测试时模板(已正确加载)呈现为对于初学者来说,代码的相关部分:测试...beforeEach(inject(function($compile,$rootScope,$templateCache){varscope=$rootScope;scope.prop=['element0','element1','element2'];//Templateloading,intherealcodethisisdonewithhtml2js,inthisexample//I'mgonnaloadjustastring(alreadycheckedtheproblempe

javascript - AngularJS ng-重复条件

我有一组JS对象(例如文档中的段落),我想使用angularJS显示它们。ng-repeat似乎是我需要的指令:{{paragraph.text}}但是,我需要做的不仅仅是在此循环中显示它们的内容。我需要在之后插入分页符(仅出于视觉目的,例如:x)像素(尝试所见即所得文档)。我的问题:是否可以有某种条件逻辑来计算前面的段落垂直使用了多少像素,如果大于x,插入一个分页符div并重置计数器?非常感谢任何帮助/建议/方向。 最佳答案 我认为你可以使用ngClass{{paragraph.text}}检查条件$scope.checkCond