我写了一个指令,$ scope中有 public override void Up()
{
DropTable("dbo.UserLogin");
CreateTable(
"dbo.UserLogin",
c => new
{
LoginProvider = c.String(nullable: false, maxLength: 128),
ProviderKey = c.String(nullable: false, maxLength: 128),
UserId = c.Int(nullable: false),
})
.PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId })
.ForeignKey("dbo.User", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId);
}
public override void Down()
{
DropTable("dbo.UserLogin");
CreateTable(
"dbo.UserLogin",
c => new
{
Id = c.Int(nullable: false, identity: true),
LoginProvider = c.String(),
ProviderKey = c.String(),
UserId = c.Int(nullable: false),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.User", t => t.UserId, cascadeDelete: true)
.Index(t => t.UserId);
}
,但在我的指令中,在data
函数中,我可以使用link
获取数据
但我是console.log(范围),范围内确实有scope.data
,但我无法获得data
有directive.js:
data
导致带有chrome的控制台:
todoApp.directive('planProgress', function() {
return {
scope: false,
link: function(scope, elem, attrs) {
console.log(scope);
attrs.$set('value', 10);
attrs.$set('total', 20);
elem.progress();
}
};
});
但如果我在directive.js中data: Array[3]
,则在console.log中为console.log(scope.data)
我不知道为什么,可以指示继承控制器吗?