Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cubitworx opened this issue Jan 22, 2016 · 0 comments
Open

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

cubitworx opened this issue Jan 22, 2016 · 0 comments

Comments

@cubitworx
Copy link

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()});
    }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant