小编Cot*_*ten的帖子

敲除数据绑定与$ index会产生问题

Concider是一个jQuery Mobile"列表",包含一个单选按钮和一个标签.

<!-- ko foreach: $data.answers -->
<input type="radio" name="radio-choice" data-bind="attr: { id: [...] }" />
<label data-bind="attr:{ for: [...] }">Label</label>
<!-- /ko -->
Run Code Online (Sandbox Code Playgroud)

为了工作,标签的for属性需要与输入的id相同.

REPLACEMENT FOR [...]            RESULTS IN
$index                           ok
'radio-nr-'+$index               fails
$root.testFunction(1)            ok
$root.testFunction($index)       fails
'radio-nr-'.concat(1)            ok
'radio-nr-'.concat($index)       fails
Run Code Online (Sandbox Code Playgroud)

哪里

function testFunction(a) {  return "radio-nr-"+a; };
Run Code Online (Sandbox Code Playgroud)

为什么我连接$ index的所有尝试都失败了?

谢谢!

knockout.js

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

使用Azure上的Bitbucket进行持续部署无法正常工作

根据这篇博文,我在Azure网站上使用bitbucket设置了git持续部署

我完成所有步骤没有任何问题但是当我git push对bitbucket没有Azure部署发生时......

如果我推送到我的azure git url,部署就像往常一样.

还有其他人有过这个问题吗?

谢谢!

git bitbucket azure

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

Xcode快捷方式打开文档项目列表

是否有键盘快捷键可打开此超赞列表(我不知道其名称)?

实用标记列表

谢谢!

xcode keyboard-shortcuts

2
推荐指数
1
解决办法
269
查看次数

带有新行的击键字符串

考虑这个

set cannedResponse to "Hello,
Thanks for your support request!
We'll take a look at the issue and get back to you as fast as possible"

tell application "System Events" to keystroke cannedResponse
Run Code Online (Sandbox Code Playgroud)

它打印文本但没有返回字符。我怎样才能得到它们?

applescript

2
推荐指数
1
解决办法
3182
查看次数

父级的 maxHeight 和溢出-y:滚动其子级之一

可以maxHeight在父级上设置并让一个特定的孩子 (1) 占用尽可能多的空间并且 (2) 已经overflow-y: scroll在那个孩子上设置了吗?

<div style="max-height: 200px">
  <div>Header that I don't want to specify any height on</div>
  <div style="max-height: auto; overflow-y: scroll">
    <div>Item no 1 in long list>
    <div>Item no 2 in long list>
    ...
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

上面的代码并max-height: auto不起作用。我最接近的是只有一个孩子并将其设置max-heightinherit这样:

<div style="max-height: 200px">
  <div style="max-height: inherit; overflow-y: scroll">
    <div>Item no 1 in long list>
    <div>Item no 2 in long list>
    ...
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

哪个有效,但如果我有 2 个孩子并且max-height: …

css

2
推荐指数
1
解决办法
3338
查看次数

运行yo angular时grunt使用的dist-folder在哪里

我使用自耕农来支撑角度应用程序,如下所示:

yo angular --minsafe
Run Code Online (Sandbox Code Playgroud)

现在,我正在尝试使用grunt-contrib-jade设置jade> html编译,但我不明白为我生成的巨大的Gruntfile.js.

有一个mountFolder函数:

var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};
Run Code Online (Sandbox Code Playgroud)

...和一个yeoman配置对象:

  // configurable paths
  var yeomanConfig = {
    app: 'app',
    dist: 'dist'
  };
Run Code Online (Sandbox Code Playgroud)

当运行grunt serverchrome打开时,我得到了我的页面.但这个神奇的'dist'文件夹在哪里被提供?我在磁盘上找不到它......

gruntjs yeoman

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

压倒ko.computed不工作

如果我们想要覆盖特定对象(不在子类中)的函数,则为Concider:

var Animal = function() {
  var self = this;

  self.hello = ko.computed(function() {
    return 'Not implemented hello';
  });

  self.greeting = ko.computed(function() {
    return self.hello() + '!!';
  });
};

var dog = new Animal();
dog.hello = ko.computed(function() {
  return 'Wooff';
});
console.log(dog.greeting());
Run Code Online (Sandbox Code Playgroud)

我期望输出为: Wooff!!

但它是: Not implemented hello!!

这是一个jsbin,我用普通的JavaScript实现它,它可以工作,而在淘汰赛中没有:http://jsbin.com/uyilot/1/edit

**编辑**

jsbin与Ryan的解决方案(现在正在工作!):http://jsbin.com/uyilot/2/edit

knockout.js

0
推荐指数
1
解决办法
467
查看次数

数据库名称为变量

我有一个存储过程的数据库,它从另一个数据库中选择数据

select * from Users in AnotherDatabase.dbo.Users
Run Code Online (Sandbox Code Playgroud)

我有几个版本的其他数据库,即

AnotherDatabaseProduction, AnotherDatabaseDevelopment, AnotherDatabaseStage
Run Code Online (Sandbox Code Playgroud)

我记得有一段时间我创建了一些全局变量AnotherDatabase_Pointer,我可以通过运行一些存储过程来设置它,如SetAnotherDatabaseToStage:

AnotherDatabase_Pointer = 'AnotherDatabaseStage' //pseudo-code
Run Code Online (Sandbox Code Playgroud)

然后我可以在我的存储过程中使用它.

但我似乎无法记住它是如何完成的.所有我能找到的是如何使用字符串替换/连接:变量数据库名称 :(

这可能吗?MS SQL.

sql-server

0
推荐指数
1
解决办法
377
查看次数