小编Epi*_*dex的帖子

在嵌套的ng-repeat中传递2 $ index值

所以我有一个ng-repeat嵌套在另一个ng-repeat中,以便构建一个导航菜单.在<li>内部ng-repeat循环中的每一个上,我设置了一个ng-click,它通过传入$ index来调用该菜单项的相关控制器,让应用程序知道我们需要哪一个.但是我还需要从外部ng-repeat传入$ index,以便app知道我们所在的部分以及哪个教程.

<ul ng-repeat="section in sections">
    <li  class="section_title {{section.active}}" >
        {{section.name}}
    </li>
    <ul>
        <li class="tutorial_title {{tutorial.active}}" ng-click="loadFromMenu($index)" ng-repeat="tutorial in section.tutorials">
            {{tutorial.name}}
        </li>
    </ul>
</ul>
Run Code Online (Sandbox Code Playgroud)

这是一个Plunker http://plnkr.co/edit/bJUhI9oGEQIql9tahIJN?p=preview

angularjs angularjs-ng-repeat

316
推荐指数
4
解决办法
18万
查看次数

C#Form.TransparencyKey针对不同的颜色工作不同,为什么?

昨天我发现了一些非常奇怪的东西(我想).它看起来像Form.TransparencyKey基于哪种颜色作为上给出不同的结果BackgroundColorTransparencyKey.如果要重现此,请执行以下操作:

  1. 创建新的Windows窗体应用程序
  2. 放下Panel表格
  3. 将它BackgroundColor设为"Green" ,并将Form1设置TransparencyKey为Green
  4. 运行程序并将带有"孔"的表单放在某些内容上,您将看到可以单击该漏洞(如MSDN所述)
  5. 现在将两种颜色更改为"红色"并运行应用程序 - 您将看到"洞",但您不再可以点击它

你知道为什么会这样吗?规则是什么?我正在使用带有VS2010的.NET 4,在具有相同配置的两台计算机上进行了测试.

这个代码不多......但我可以在设计师中发布设置:

private void InitializeComponent()
{
     this.panel1 = new System.Windows.Forms.Panel();
     this.SuspendLayout();
     // 
     // panel1
     // 
     this.panel1.BackColor = System.Drawing.Color.Red;
     this.panel1.Location = new System.Drawing.Point(23, 26);
     this.panel1.Name = "panel1";
     this.panel1.Size = new System.Drawing.Size(229, 176);
     this.panel1.TabIndex = 0;
     // 
     // Form1
     // 
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize = new System.Drawing.Size(284, 262);
     this.Controls.Add(this.panel1);
     this.Name = "Form1";
     this.Text = "Form1"; …
Run Code Online (Sandbox Code Playgroud)

.net c# winforms

12
推荐指数
1
解决办法
4270
查看次数

用ui-router转到祖父母的状态

随着ui-router我可以使用$state.go('^')去父状态,而不必指定它的完整路径.有没有类似的方式去祖父母州(我的父州是抽象的)?

文档示例中,我只能看到^父母,但也许有人有这个好的解决方案?

angularjs angular-ui-router

12
推荐指数
1
解决办法
1013
查看次数

两个div一个在另一个上面漂浮

我试图将两个div放在父div的右侧,一个在另一个之上.像这样的东西:

 div#top 
|-------------------------------------||------------|
|div#parent                           ||div#menu    |
|                          |---------|||float:right |
|                          |div#up   |||            |
|                          |         |||            |
|                          |---------|||------------|
|                                     |
|                          |---------||
|                          |div#down ||
|                          |         ||
|                          |---------||
|-------------------------------------|
Run Code Online (Sandbox Code Playgroud)

任何想法如何使用CSS?我不能在这里使用表格,因为在主页面(ASP.NET)中添加了div#up,在内容中添加了div#down.Div#parent是液体,有一些最小宽度设置,并且包含不应该被这些div重叠的内容,所以我认为position:absolute在这里也是不可能的.

还有一个细节:在div#parent的左侧和右侧,有两个div使用菜单左右浮动.所以添加清楚:左/右到div#向下浮动右边将它放在这些菜单之一...

html css positioning

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

在发送答案之前收到ICE候选人时的错误

我正在Chrome 23上建立WebRTC连接.要附加本地流,您需要允许浏览器使用摄像头和麦克风.在呼叫者方面,我正在检查是否可以获得本地流,直到这一刻我才发送报价.然后发送报价,浏览器立即开始发送ICE候选人.

那么,如果没有得到当地媒体流远程浏览器还没有我得到SYNTAX_ERR: DOM Exception 12peerConnection.addIceCandidate(candidate)对收到的每个ICE候选人.

我检查了文档,addIceCandidate但没有关于先决条件的信息.

我想我可以通过延迟发送ICE候选人并等待远程客户端添加本地流的信号来延迟发送ICE候选者,但这是需要额外的通信并且看起来不正确.

我可以以某种方式添加远程ICE候选者,webkitRTCPeerConnection然后才能发送应答并连接本地媒体流吗?

google-chrome webrtc

8
推荐指数
1
解决办法
6075
查看次数

SelectMany创建了许多SQL select语句,而不是带有join的语句

我正在编写一个查询SelectMany并检查它在LINQPad中生成的SQL.查询非常简单.

比方说,我有3个实体:Customer,Order,OrderItem.OrderItem掌握有关订购的产品和数量的信息.

我想OrderItems为一位客户提供所有服务.

context.Customers.First().Orders.SelectMany(o=>o.OrderItems)
Run Code Online (Sandbox Code Playgroud)

我得到了我期望的结果集,但SQL对我来说真的很奇怪.有一堆选择语句.首先,它选择一个客户,这是好的.然后选择一个订单(因为这个客户只有一个),然后创建一个选择每个OrderItem在之前选择的Order...所以,因为有我获得尽可能多的选择OrderItems+ Orders的选择Customer.所以它看起来像:

select top 1 from Customers;

select * from Orders where CustomerID = @cID;

select * from OrderItems where OrderID = @o1;
select * from OrderItems where OrderID = @o2;
select * from OrderItems where OrderID = @o3;
select * from OrderItems where OrderID = @o4;
Run Code Online (Sandbox Code Playgroud)

我期望的是:

select oi.* 
from OrderItems oi
join Orders …
Run Code Online (Sandbox Code Playgroud)

linq-to-entities entity-framework

8
推荐指数
1
解决办法
3675
查看次数

如何使用Moq与Entity Framework IDbSet Count()等方法

我正在尝试使用MoqEntity Framework Code First类进行一些测试.我对Moq和模拟技术都很陌生,我想知道是否可以轻松地进行下面将要描述的测试.我在网上搜索了一些解决方案,但大多数是基于存储库模式,我想避免.

我有ITestEntities上下文的接口

public interface ITestEntities
{
    IDbSet<Order> Orders { get; }
    IDbSet<Product> Products { get; }
    IDbSet<User> Users { get; }
}
Run Code Online (Sandbox Code Playgroud)

然后是背景

public class TestEntities : DbContext, ITestEntities
{
    public TestEntities() : base("name=TestEntities")
    {

    }

    public virtual IDbSet<Order> Orders { get; set; }
    public virtual IDbSet<Product> Products { get; set; }
    public virtual IDbSet<User> Users { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

控制器和要测试的动作

public class HomeController : Controller
{
    private ITestEntities db;

    public HomeController() …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc unit-testing entity-framework moq

8
推荐指数
1
解决办法
9517
查看次数

使用jQuery查找以文本开头的标签

我有一些标签,如:

<label>Some words</label>
<label>Some other words</label>
<label>Yet another words</label>
Run Code Online (Sandbox Code Playgroud)

如何获得以"Some"(或其他文本?)开头的标签.我试过了

$("label").filter('html^="Some"')
//or
$("label").filter('text^="Some"')
Run Code Online (Sandbox Code Playgroud)

但它似乎不起作用(返回空列表).它在我的真实问题中更复杂,所以也许我犯了一些其他错误,但也许我做错了?这些都是一个很好的方法吗?什么是最好的方式?

jquery jquery-selectors

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

使用前导零和千位分隔符格式化数字

我想以同时具有前导零和千位分隔符的方式格式化整数。

我知道这someInt.ToString("D6");会给我前导零,但显然它不允许NumberGroupSeparator。另一方面someInt.ToString("N");会给我分隔符但没有前导零......

是否可以将两者结合起来123456打印00 123 456?我知道我可以创建字符串N,然后在循环或其他内容中手动向字符串添加零,但也许有更好的方法?

编辑:填充零的数量(数字的总位数长度)应该是可调的。

c# formatting tostring

5
推荐指数
1
解决办法
5975
查看次数

如何在.NET Chart控件中为堆叠系列添加点?

我在winforms应用程序中放置了一个图表控件,然后尝试添加一些数据以显示为堆积柱形图.无论我多么努力,我都无法让第二个系列正常显示.我通过删除其他所有内容并仅留下2个系列和最少量的数据来隔离该问题.

图表代码:

System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
this.SuspendLayout();
// 
// chart1
// 
chartArea1.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea1);
legend1.Name = "Legend1";
this.chart1.Legends.Add(legend1);
this.chart1.Location = new System.Drawing.Point(49, 62);
this.chart1.Name = "chart1";
series1.ChartArea = "ChartArea1";
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn;
series1.Legend = "Legend1";
series1.Name = "Series2";
series2.ChartArea = "ChartArea1";
series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn;
series2.Legend = "Legend1";
series2.Name = "Series3";
this.chart1.Series.Add(series1);
this.chart1.Series.Add(series2);
this.chart1.Size = new System.Drawing.Size(534, 300);
this.chart1.TabIndex …
Run Code Online (Sandbox Code Playgroud)

.net mschart winforms

5
推荐指数
1
解决办法
6764
查看次数