小编Chr*_*ian的帖子

AngularJS - 访问子指令控制器

如何访问子指令控制器?具体来说,我需要访问父指令中存在的所有ngModelController.例:

<parent-directive>
  <input type="text" ng-model="model1"/>
  <input type="text" ng-model="model2"/>
</parent-directive>
Run Code Online (Sandbox Code Playgroud)

那么,"parentDirective"是否有办法访问"model1"和"model2"的ngModelControllers?

javascript angularjs angularjs-directive angularjs-scope angularjs-ng-model

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

Angularjs UI引导程序在静态选项卡中动态选择不起作用

我有三个静态选项卡和一个按钮,使用ng-click ="selectThirdTab()"

<div ng-controller="Ctrl">
        <input type="button" value="Select third tab" ng-click="selectThirdTab()" />
        <tabset justified="true">
            <tab heading="First" active="isFirstActive"></tab>
            <tab heading="Second" active="isSecondActive"></tab>
            <tab heading="Third" active="isThirdActive"></tab>
        </tabset>
</div>
Run Code Online (Sandbox Code Playgroud)

函数"selectThirdTab"如下:

$scope.selectThirdTab = function () {
    $scope.isThirdActive = true;
}
Run Code Online (Sandbox Code Playgroud)

吸管在这里:Plunker

最初选择第一个选项卡,单击按钮,结果是选中的第三个按钮.现在,如果您选择其他选项卡,然后再次单击"选择第三个选项卡"按钮,则不会选择第三个按钮.怎么了?

tabs angularjs angular-ui-bootstrap

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

asp.net - 绑定到嵌套集合的MVC模型

我有一节课:

public class ClientInformation{
    public string UserName {get; set;}
    public ICollection<RegionDistrictCity> RegionDistrictCity
    {
        get;
        set;
    }

  public class RegionDistrictCity
  {
     public string Region { get; set; }
     public string District { get; set; }
     public string City { get; set; }
  }
}
Run Code Online (Sandbox Code Playgroud)

为了使模型绑定器填充集合"ICollection RegionDistrictCity",应如何在html中为属性Region,Distirct,City格式化输入元素的name属性?

我尝试使用类型为"ClientInformation"的参数的动作方法和格式化为"[index] .PropertyName"的html名称属性,但在这种情况下,只有属性"UserName"被绑定.

我尝试使用参数名称"client"的操作方法,并将html名称属性格式化为"client [index] .PropertyName",但它不起作用.(如果我有一个"列表客户端",那么它会被填充)

谢谢.

model-binding asp.net-mvc-4

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

GO命令在事务中的奇怪行为

如果我运行以下内容:

CREATE TABLE t1  
    (a INT NOT NULL PRIMARY KEY);  
CREATE TABLE t2  
    (a INT NOT NULL REFERENCES t1(a));  

INSERT INTO t1 VALUES (1);  
INSERT INTO t1 VALUES (3);  
INSERT INTO t1 VALUES (4);  
INSERT INTO t1 VALUES (6);  
GO  
Run Code Online (Sandbox Code Playgroud)

然后我运行这个:

SET XACT_ABORT ON; 

BEGIN TRANSACTION
INSERT INTO t2 VALUES (1)

INSERT INTO t2 VALUES (2) -- Foreign key error, entire transaction rolled back

INSERT INTO t2 VALUES (3)

COMMIT TRANSACTION
Run Code Online (Sandbox Code Playgroud)

一切都好; 事务被回滚,因为我们在t1中没有值2,因此表t2为空

但是,如果我GO在此事务中间添加一个命令,则事务不会回滚,并且数字3将插入到表t2中.这是代码:

SET XACT_ABORT ON; 

BEGIN …
Run Code Online (Sandbox Code Playgroud)

sql sql-server

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