Skip to content

"Maximum call stack size exceeded" when compiling component with no View template or templateUrl #1326

Closed

Description

@matthewjh

Given

@Component({
  selector: 'app'
})
@View({
})
class AppComponent {}

bootstrap(AppComponent);

Angular fails with

Uncaught TypeError: Cannot redefine property: onclick
Uncaught RangeError: Maximum call stack size exceeded

There's an existing throw intended to handle views without a template or templateUrl, but it never gets hit because the viewDefinition's absUrl property gets set in Compiler#_buildRenderTemplate regardless.

Activity

  1. added a commit that references this issue on Apr 12, 2015
    83391e6
  2. matthewjh commented on Apr 12, 2015

    @matthewjh
    ContributorAuthor

    See PR, which I think provides a quick fix for this issue.

    Personally, though, I think it's a bit odd that absUrl has two slightly different uses: to store the URL of the template if there is one, and to store the URL of the component otherwise for stylesheet loading. Why not have both absUrl (to use for loading resources e.g. stylesheets) and templateUrl on a ViewDefinition? Seems clearer.

  3. tbosch commented on Apr 13, 2015

    @tbosch
    Contributor

    Thanks for catching this! Your PR looks good.
    On Sun, Apr 12, 2015 at 10:14 AM Matthew Hill notifications@github.com
    wrote:

    See PR, which I think provides a quick fix for this issue.

    Personally, though, I think it's a bit odd that absUrl has two slightly
    different uses: to store the URL of the template if there is one, and to
    store the URL of the component otherwise for stylesheet loading. Why not
    have both absUrl (to use for loading resources e.g. stylesheets) and
    templateUrl on a ViewDefinition?

    —
    Reply to this email directly or view it on GitHub
    #1326 (comment).

  4. added a commit that references this issue on Apr 24, 2015
    1aac151
  5. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions