Skip to content

#ionModal component converting "numeric String" to Number #371

Description

@cubitworx

Summary

When using ionModal, meteor-iconic appears to converting the document _id to a Number if it comprises only numeric digits.

Example

Given the following URL http://host/test/1 for document { _id: "1" [, ...] }

A page template of:

<template name="myPage">
    <button data-ion-modal="myModal" data-id="{{this._id}}">Show</button>
</template>

An ionModal template of:

<template name="myModal">
    {{#ionModal}}
        {{doc._id}}
    {{/ionModal}}
</template>

The template.instance().data.id property in the ionModal template helper is of type Number instead of String:

Template.myModal.helpers({
    event: function () {
        var template = Template.instance();

        // The following shows the id property to be of type Number instead of String
        console.log( template.data.id );

        // Which means that something like this does not work
        return myCollection.findOne({_id: template.data.id});
        // The above does work if the document _id contains at least 1 alpha character

        // Which means that you need to do this instead
        return myCollection.findOne({_id: template.data.id.toString()});
    }
});

Activity

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions