小编tar*_*ahf的帖子

Angular 可编辑下拉菜单 - 根据所选值进行编辑

更新 1:开发了第一个示例代码,为正确实施奠定基础。
更新 2:开发了一个工作模型。见答案。

我找到了这个库:

https://libraries.io/bower/editable-dropdown-angularjs

它允许使用 HTML5 数据列表功能添加可编辑的下拉列表。

它工作正常,但是,唯一需要的功能是仅当所选值为“其他”时才使字段可编辑。

根据存储库中的演示查看 plunkr.co vreated 中的工作示例

http://plnkr.co/edit/wDm2mbTqTsT1YC5H7UPy?p=preview

有关详细信息,请参阅下面的示例代码。

感谢您的建议,使下拉字段仅在所选值为“其他”时可编辑。

HTML5:

<div ng-app="myApp">
    <div ng-controller="demo" style="width:300px;position:fixed;top:20px;left:20px">    
        <p>You selected {{selected}}</p>
        <editable-dropdown options='list' ng-model='selected'></editable-dropdown>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

JavaScript:

angular.module('myApp', ['editableDropdown'])
.controller('demo', function($scope){
    $scope.list = ['one', 'two', 'other']
    $scope.selected;
});
Run Code Online (Sandbox Code Playgroud)

我能够使用 jsfiddle 开发这个示例代码(基于这个答案):

http://jsfiddle.net/tarekahf/t392djx1/

如果选择“其他”,这将允许使下拉列表可编辑。现在,我正在将此模式转换为 Angular 方式。如果您有任何建议,请告诉我。

html angularjs dropdown

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

如何使用 PowerShell 解析 Windows 命令“wmic”的输出

我正在尝试解析以下输出:

wmic copmutersystem
Run Code Online (Sandbox Code Playgroud)

net.exe config workstation
Run Code Online (Sandbox Code Playgroud)

使用 PowerShell 获取对象作为键/值对和/或将其转换为 JSON 字符串。

我知道有一个 PowerShell 等效命令:

Get-CimInstance  -Class Win32_computersystem
Run Code Online (Sandbox Code Playgroud)

但这里的问题是弄清楚如何使用 PowerShell 解析wmicCMD 行的类似输出。

powershell wmi parsing json wmic

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

如何通过 git pull 来对具有多个合并提交的功能分支进行变基,以便能够压缩它们

在某些情况下,我在功能分支上执行 git pull 操作,最终得到多个烦人的“合并提交”,我可以理解它们为什么会发生,但我想将它们合并起来,使其看起来像正常提交。

我尝试使用git rebase -i --rebase-merges HEAD~4但无法弄清楚如何压缩合并提交。

我做了进一步的研究,经过大量的挖掘,我能够执行以下操作,使用 rebase 将不需要的合并提交合并到正常提交中,然后在需要时压缩它们:

git checkout feature
git pull  # will create merge commits
git checkout featur_backup  # to create a backup
git switch --orphan emty_commit
git commit -m "First empty commit for the feature branch" --allow-empty
git switch feature
git rebase empty_commit
git rebase -i --root  # this allows you to squash commits
git branch -D empty_commit
Run Code Online (Sandbox Code Playgroud)

有没有更好的方法来合并合并提交?

笔记:

  • 该功能分支是一个孤立分支
  • 文件从主分支单独签入功能分支
  • 此功能分支用于编译要在目标计算机上应用的更改
  • 更改是在来自不同机器的功能分支中进行的,这就是为什么我们最终会在 git pull 后看到合并提交。

git merge commit rebase squash

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

标签 统计

angularjs ×1

commit ×1

dropdown ×1

git ×1

html ×1

json ×1

merge ×1

parsing ×1

powershell ×1

rebase ×1

squash ×1

wmi ×1

wmic ×1