Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

So I am trying to write an AngularJS (version 1.4.8) directive which outputs the value of an attribute in an input box. The directive looks like this:

(function () {

    angular.module("myApp").directive("inputAttributeDirective", function () {
    return {
        templateUrl: "inputAttributeTemplate.html",
            // The directive is a custom element
            restrict: "E",
            // Declare the scope of the directive as isolated
            scope: {
                attribute: "=",
                value: "="
            }
        }
    });

})();

And the HTML template for it is the following (that's in inputAttributeTemplate.html):

<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>

Where 'attribute' and 'value' correspond to the attributes of an object called 'Client' that looks like this:

vm.client = { name: "Some Client", description: "This is a cool client", networkPath: "network path 1", active: "1" }

So basically, a Client has four attributes, name, description, networkPath, and active.

And the way I am including the directive is like so (this is in the parent HTML file):

    <div class="panel-body">

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

    </div>

The problem is that, while it does display the attributes correctly, they are read-only and I need them to be editable:

enter image description here

Any idea why they are read-only?

share|improve this question
    
Are the inputs in a fieldset tag? If so the fieldset may be set to readonly – Umer Z Dec 12 '16 at 19:55
    
Can you post a plunkr? – Thierry Dec 12 '16 at 19:56
    
@UmerZ Nope, not in a fieldset – lukegf Dec 12 '16 at 19:56
3  
Also, probably a typo, but your directive's don't match. Just making sure you are using the correct directive. incident-attribute-directivevs inputAttributeDirective – Ronnie Dec 12 '16 at 19:56
    
@Ronnie That was it! Wow I can't believe I missed that. I feel silly now. Thanks. – lukegf Dec 12 '16 at 19:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.