Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

directives scope with optional attributes? #1131

Closed
@johnnyelwailer

Description

@johnnyelwailer

Hi
I have a directive with its own scope.

scope: {optionalAttribute: '='}

I want the attributes to be optional.

if (scope.optionalAttribute == null)
{
scope.optionalAttribute= 'unnamed';
}

http://jsfiddle.net/johnnayweiler/28fJP/

This gives me the 'Non-assignable model expression'error.
Why is that so and how to enable default values for those attributes(make them optional)?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions