AngularJS指令输入字段是只读的

时间:2016-12-12 19:47:34

标签: angularjs angularjs-directive

所以我正在尝试编写一个AngularJS(版本1.4.8)指令,该指令在输入框中输出属性的值。该指令如下所示:

<label id="AttributeLabel" class="control-label">{{ attribute }}</label>
<div id="AttributeInput" class="input-prepend">
    <input id="attributeName" name="attributeName" class="form-control input-large" type="text" ng-model="value"/>
</div>

它的HTML模板如下(在inputAttributeTemplate.html中):

    <div class="panel-body">

        <div ng-repeat="(key, value) in vm.client">
            <incident-attribute-directive attribute="key" value="value"></incident-attribute-directive>
        </div>

    </div>

其中'attribute'和'value'对应于名为'Client'的对象的属性,如下所示:

  

vm.client = {               名称:“一些客户”,               描述:“这是一个很酷的客户”,               networkPath:“网络路径1”,               活跃:“1”           }

基本上,客户端有四个属性,名称描述 networkPath 活动。< / p>

我包含指令的方式是这样的(这是在父HTML文件中):

Push-Location; Import-Module SQLPS -DisableNameChecking; Pop-Location

$SQLServer = "localhost\inst1"
$DBName = "ExportCSVTesting"
$ExportFile = "C:\Users\BIGRED-7\Documents\Git\csvfiles\addresses.csv"
$Counter = 0

while ( $true )
{
    # Remove the export file
    if (Test-Path -Path $ExportFile -PathType Leaf) {
        Remove-Item $ExportFile -Force
    }

    # Clear the buffer cache to make sure each test is done the same
    $ClearCacheSQL = "DBCC DROPCLEANBUFFERS"
    Invoke-Sqlcmd -ServerInstance $SQLServer -Query $ClearCacheSQL

    # Export the table through the pipeline and capture the run time. Only the export is included in the run time.
    $ExportSQL = "SELECT * FROM [addresses] ;"

    $sw = [Diagnostics.Stopwatch]::StartNew()
    Invoke-Sqlcmd -ServerInstance $SQLServer -Database $DBName -Query $ExportSQL | Export-CSV -Path $ExportFile -NoTypeInformation
    $sw.Stop()
    $sw.Elapsed
    $Milliseconds = $sw.ElapsedMilliseconds

    # Get a row count for display
    $RowCountSQL = "SELECT COUNT(0) AS [Count] FROM [addresses] ;"
    $RowCount = Invoke-Sqlcmd -ServerInstance $SQLServer -Database $DBName -Query $RowCountSQL
    $RowCount = $RowCount.Count

    $Counter++
    Write-Output ("Run $Counter of RowCount: $RowCount")

    # Log the run statistics
    $StatsSQL = "INSERT INTO [RunStats] (Counter,Milliseconds,Notes) VALUES ($RowCount,$Milliseconds,'Pipeline')"
    Invoke-Sqlcmd -ServerInstance $SQLServer -Database $DBName -Query $StatsSQL
}

问题是,虽然它确实正确地显示了属性,但它们是只读的,我需要它们是可编辑的:

enter image description here

知道为什么他们是只读的吗?

0 个答案:

没有答案