2016-03-26 7 views
-1

角カッコでHTMLコメントを表示するにはどうすればよいですか?
リテラルを描画します。かっこ付きのHTMLコメントを表示するには? <! - {{myModel.myProperty}} - >

<div data-ng-switch='field.TypeAsString'> 
    <label for="{{field.InternalName}}" class="control-label">{{field.Title}}:</label> 
    <!-- FieldName="{{field.odata.type}}" 
    FieldInternalName="{{field.InternalName}}" 
    FieldType="{{field.odata.type}}" 
     --> 
    <span data-ng-switch-when='Text'> 
     <input id="{{field.InternalName}}" class="form-control" data-ng-model="field.value" type='text' /> 
    </span> 
</div> 

戻り

<div data-ng-switch="field.TypeAsString" class="ng-scope"> 
<label for="Title" class="control-label ng-binding">Title:</label> 
<!-- FieldName="{{field.odata.type}}" 
FieldInternalName="{{field.InternalName}}" 
FieldType="{{field.odata.type}}" 
    --> 

<!-- ngSwitchWhen: Text --><span data-ng-switch-when="Text" class="ng-scope"> 
    <input id="Title" class="form-control ng-pristine ng-valid ng-empty ng-touched" data-ng-model="field.value" type="text"> 
</span><!-- end ngSwitchWhen: --> 
<!-- ngSwitchWhen: Note --> 
<!-- ngSwitchWhen: Number --> 
<!-- ngSwitchWhen: Choice --> 
<!-- ngSwitchWhen: Lookup --> 

+0

明確ではありません。より具体的にしてください – charlietfl

答えて

0
私が探している

ターの答え:あなたが異なることを期待し、何をしても求めているか、どのようなすべてのHow can I insert an HTML comment with an interpolated expression?

The syntax to invoke a directive on a comment is: 

<!-- directive: foo expression --> 
I was hoping that something like ng-bind supported comments, but it doesn't. But you could easily create your own: 

app.directive('comment', function($interpolate) { 
    return { 
    restrict: 'M', 
    scope: true, 
    link: function(scope, element, attrs) { 
     var comment = $interpolate(attrs.comment)(scope); 
     element.replaceWith("<!-- " + comment + "-->"); 
    } 
    }; 
}); 
And the usage is: 

<!-- directive: comment "something something {{item.id}}" --> 
関連する問題