Menu
  • HOME
  • TAGS

Why are my meteor settings not being passed to the application?

Tag: meteor,meteor-helper

set METEOR_SETTINGS={"public": {"stage": "development"}}
meteor

Then this line:

console.log(Meteor.settings.public.stage);

causes this error:

W20150612-20:45:38.338(-7)? (STDERR) TypeError: Cannot read property 'stage' of undefined

What am I doing wrong?

Best How To :

From what I understand the environment variable is only for the deployment mode (running a bundle).

In development, i.e., when running meteor, you need to use the --settings command line parameter to specify a file containing the settings.

Meteor router and url paramaters

javascript,meteor,iron-router

A few suggestions: this.route('home', { path: '/:_id', data: function() { // assuming you have a collection called "Threads" return Threads.findOne(this.params._id); } }); You need a template called 'home'. It's data context will be the return of the data callback You do not need to place a ? in the path...

TypeError: Cannot read property 'slice' of null

meteor,meteor-autoform,meteoric

This is a issue with the new patch for autoform-ionic to the new versions of autoform. Apparently some labels are skipped, some not (see here). In order to fix that and avoid this error when your input type is not there (for example, type = number), all your schema fields...

Use a “months” array to perform calculations for each month in a for loop

javascript,arrays,meteor,meteor-helper

I think you want to get the properties from your currentProject object by using the month as a key. Like this: var months = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","des"]; var arrayLength = months.length; var rtcw = {}; for (var i = 0; i < arrayLength; i++) { alert(months[i]); // Need to Calculate rtcw for...

MeteorJs mobile-config settings for landscape only?

javascript,android,ios,meteor,mobile-application

After searching on the topic i came to conclusion that its an open bug and only way to prevent portrait mode on apple's ipad is by manually editing the settings through XCode. You can check out but here ...

Meteor.users.find() - how to filter by group in alanning:roles package

meteor,mongodb-query,roles,groups

This code has about a 5% chance of working out of the box because I have no collection to test this on, I have no way of running this code, I don't have the roles package, I don't have your users database, and I've never done .map on a cursor...

Meteor Iron Router resubscribe on Rights change with meteor-roles

meteor,iron-router

Say that the user is on a route /something You have some data that changes and you create a session variable: Session.set("someDataThatChanges", myChangedData) Your publish function takes some sort of input, which it uses to return different data from the collection: Meteor.publish("myCollection", function(input){ return myCollection.find( // do something here based...

Using Meteor.call inside a server router

meteor

Just restructure your method where you also name the function of the method, then you have two entry points into whatever code it is you'd like to execute: addUser = function() { ... }; Meteor.methods({'addUser': addUser}); Router.route('/sms/inbound', function () { if (something) { addUser({ name: "hello", age: 20 }); }...

Filtering records according to dropdownlist

meteor,meteor-helper

You need to enforce the filters one after the other. Try like that: var filterAndLimitResults = function (cursor) { if (!cursor) { return []; } var raw = cursor.fetch(); var currentChosenCategory = chosenCategory.get(); var currentChosenCity = chosenCity.get(); var currentJtype = chosenJtype.get(); console.log(currentChosenCategory); console.log(currentChosenCity); // filter category var filtered = [];...

Convert ng-click to Blaze in meteoric

angularjs,meteor,ionic-framework,meteor-blaze,meteoric

Try to set up a template around your html: <template name="myTemplate"> <div class="list"> <a id="myDiv" class="item item-icon-right nav-clear" href="#/app/list1"> <i class="icon ion-ios7-paper"></i> Item 1 </a> .... </div> </template> Then put this code into your js file: Template.myTemplate.events({ "click #myDiv": function( event) { // yourFunction }, }); ...

Meteor: group documents and publish an object

javascript,meteor

It depends of you want to do it on client or server. First, the obvious solution: if you have no specific reason to store them with the first structure, store them directly using the second. Second, another easy solution is to make in client. Here is a non tested code...

Testing Meteor packages with Velocity?

meteor,jasmine,meteor-velocity

Yes, it is possible to test packages with sanjo:jasmine. It works in nearly the same way as with TinyTest. You can find all information to get started in the sanjo:jasmine README. There is also an example package. To run the tests, use the commands from the README. If you need...

Working with embedded documents in MongoDB

javascript,mongodb,meteor

In keeping with your current schema (not recommended): First, save the entire document to the client: doc = { _id: 1, projectName: name, managers: [ { managerId: "manager1", status: false, startDate: "startDate", endDate: "endDate" }, { managerId: "manager2", status: false, startDate: "startDate",endDate: "endDate" }, { managerId: "manager3", status: true, startDate:...

Cannot connect to MongoDB inside a template

meteor

You cannot attach helpers to body. Helpers have to be attached to a template. What you should do is this: in the HTML: <body> {{> membersList}} </body> <template name="membersList"> <ul> {{#each members}} <li>{{name}}</li> {{/each}} </ul> </template> In the JS: Template.membersList.helpers({ members: function() { return Members.find(); } }); ...

How can I assign data context in onCreated

javascript,meteor

this.data is immutable. To replace the data context either wrap your mine template and pass the correct data. E.g.; <template name="mineWrap"> {{> mine mydata}} </template> Or, store your data directly on the template instance. E.g.; Template.mine.onCreated(function () { this._myData = 'data'; }); Template.mine.helpers({ myData: function () { return Template.instance()._myData; }...

Pass router parameters in Router.go()

meteor,iron-router

Read about it here Router.route( '/admin/users/details/:userID', { name: 'admin.details', ... } ); Template.AdminUsersDetailsDetailsForm.events({ "click #form-back-button": function(e, t) { e.preventDefault(); Router.go('admin.details', {userId:'USER_ID'}); } You can generate url using: Router.path('admin.details', {userId:'USER_ID'}); ...

Insert data in collection at Meteor's startup

javascript,json,meteor,data,startup

Ok, you'll want to check out Structuring your application. You'll have to make the file with the definition load earlier, or the one with the fixture later. Normally you have your collections inside lib/ and your fixtures inside server/fixtures.js. So if you put your insert code into server/fixtures.js it'll work....

Meteor/MongoDB limiting the result

mongodb,meteor

Meteor's collection API is somewhat different from that of the mongo API. find takes up to two parameters: a selector object, and an options object. options allows you to specify such things as sort, skip, limit and fields, in addition to the meteor-specific reactive and transform.

CKeditor outputs Html. How to format it for displaying properly, not just lame html?

javascript,html,css,meteor,ckeditor

You use triple braces in spacebars for this. So your answer is {{{body}}} ...

jQuery component stop working when routing

meteor

I've seen a similar issue, it makes me think that when you are "changing pages" you are not actually "destroying" the template temp, as the selectpicker() doesn't get called again when you "change back". You don't show enough information to answer this accurately, but you can try Destroying the selectpicker()...

Meteor - Multiple data contexts with Iron Router

meteor,iron-router

Your data object declaring syntax is wrong, it should be : this.render('PackageDetails', { data: { package: package, listItems: listItems } }); Then in your template, you can reference the data context using {{package.property}} and {{#each listItems}}....

Router path for page navigation

meteor,iron-router

try the following in your router.js file Router.route('template1/template2',function() { this.render('template2'); }); ...

How do I make a slight modification to a package locally in Meteor?

javascript,meteor

Create a packages/ directory at the top level directory of your app (myapp/packages) and simply git clone the package you want to modify into it. Add the package via meteor add and you'll be able to edit the files of the package you just cloned. ...

Meteor - Query Embedded Documents

javascript,mongodb,meteor

Use fields (?): return MyCollection.find({},{fields:{"MWLink.LinkID": 1}}).fetch(); If you feel you need a bit more power on what comes up you can use map (?) or a transform (?): var transform = function(doc) { return { MWLink : { LinkID: doc.MWLink.LinkID } } } //A transform returns a cursor return MyCollection.find({},...

how i add collaborators side-view in atmosphere?

meteor

You have to add maintainers to the package like this meteor admin maintainers <yourusername-or-organization:your-package> --add <collaborator-username> meteor admin maintainers iron:router --add mrt Then their name will be shown in collaborators/contributors list...

MeteorJS Blaze.getData() occasionally returns undefined

meteor,meteor-blaze

It turns out the issue was within the click event. I had a nested span element within my share-course button: <small class="share-course" data-courseid="{{_id}}"> Share <span class="glyphicon glyphicon-share"></span> </small> This was messing up the way I was targeting my embedded courseID Instead of Blaze.getData(), I should have also been using Template.currentData()...

Meteor - Requests randomly failing

meteor,request-cancelling

Finally found the source of my problem maybe my answer would help other Meteor developers. I used to do this : var providersSub = Meteor.subscribe('providers'); Tracker.autorun(function () { if(!providersSub.ready()) return; var providerIds = _.pluck(Provider.all().fetch(), '_id')); ... this.stop(); }); Instead of : var providersSub = Meteor.subscribe('providers'); Tracker.autorun(function (computation) { if(!providersSub.ready()) return;...

DB relationship: implementing a conversation

mongodb,meteor

It all depends on usage patterns. First, you normalize: 1 conversation has many messages, 1 message belongs to 1 conversation. That means you've got a 1-to-many (1:M) relationship between conversations and messages. In a 1:M relationship, the SQL standard is to assign the "1" as a foreign key to each...

What is cursor?

meteor

The Meteor cursor is like a lazy version of the array of documents. It's designed to iterate through the results of a query while not actually loading each of the documents until they are actually requested or the cursor is at the position containing the document. Its better to think...

Meteor: Load scss files in a certain order

meteor,sass

Here you go: https://github.com/fourseven/meteor-scss Very popular and actively-managed package for SCSS users....

Using a helper with arguments AS a helper argument in Spacebars

meteor,spacebars

I think that you cannot chain two helpers with parameters on the second one like you did. Subsequent parameters will still be interpreted as parameters from the first helper. I see two ways for solving this problem: 1) you could get rid of the parameters and use the data context...

Meteor file upload with Meteor-CollectionFS giving error method not found

meteor

Make sure you also define this collection on the server side: Uploads =new FS.Collection('uploads',{ stores: [new FS.Store.FileSystem('uploads',{path:'~/projectUploads'})] }); The reason it can't find the method is the collection isn't defined on the server side (in the /server folder) or in a block of code that runs in if(Meteor.isServer) { instead...

Disabling tail.sh for specific server ( or environment )?

javascript,meteor

I think this feature should be disabled for dev environments. It will probably be done so :] Not sure if this counts as an answer. I made a GH ticket to track the progress until its updated: https://github.com/Tarang/Meteor-Analytics/issues/28...

Meteor Iron Router not loading template

javascript,meteor,iron-router

Your call to the Router.map function is unnecessary. It doesn't do much, as you can see here. Also you can omit the onBeforeAction hook if you're just calling this.next(). But I too, don't see anything wrong with your code. Here are some things you could try tho: Check if your...

How to return value in Meteor.JS from HTTP.call “GET”

javascript,ajax,http,meteor,facebook-javascript-sdk

Don't pass a callback to get the HTTP to return. You're also able to pass off URL parameters quite easily: var result = HTTP.call("GET", "https://graph.facebook.com/me", { params: { access_token : Meteor.user().services.facebook.accessToken, fields : "likes.limit(5){events{picture,cover,place,name,attending_count}}" } }); console.log(result); ...

Meteor collections: how to connect to different collections referring to each other?

meteor,meteor-helper,meteor-collections

You might be better off using Contracts._id to refer to a contract from the Reminders collection that way if the contract name and description change at some point you won't need to update all the related reminders. Contract: { "_id": "tPN5jopkzLDbGypBu", "contract": "C-42432432", "description": "Description of contract", "counterpart": "Company name",...

Creating meteor autoform w/ array of radio buttons

meteor,meteor-autoform

Yup! You can simple define arrays in SimpleSchema using this notation: ... 'problems': { type: String, autoform: { afFieldInput: { options: function () { return { one: 'one', two: 'two', three: 'three', four: 'four', five: 'five', six: 'six', } } } } } ... And in your template {{ >...

Meteor: Passing Session values from client to server

javascript,node.js,session,meteor

I don't really understand your need. Why do you want to share Session with Server ? Session is client-side only, but you can send value if your session with Meteor Methods, or in your subscription. In the second case, your sbscription can be reactive with the Session dependancy. Could you...

XMLHttpRequest to Restivus API

javascript,meteor,xmlhttprequest,cross-domain,cors

The answer is more than obvious after finding out. I just need to to set the options method in the restivus route to authRequired: false. You cannot send a complete header with credentials when doing a preflight. Now I am first doing the preflight and then sending the real post.

Accessing parent helper in Meteor

javascript,meteor

There isn't an obvious way to do this in the current version of meteor. One solution is for the child template to "inherit" the helpers from the parent. You can do this pretty easily using meteor-template-extension. Here's an example: html <body> {{> parent}} </body> <template name="parent"> <h1>parent</h1> {{> child}} </template>...

Turning the Stripe Checkout into a Synch function

meteor,stripe-payments

This should work and result should populate with a result as you see in the stripe documentation: var result = stripeChargesCreateSync({ source: stripeToken, amount: (info.timeRequired/15)*500, // this is equivalent to $50 currency: 'gbp' }); This is where the error is, use this: var stripeChargesCreateSync = Meteor.wrapAsync(Stripe.charges.create, Stripe.charges); instead of var...

Get json values from key-value pair without passing keys in meteor

javascript,json,mongodb,meteor

JS Template.test.helpers({ itemsArray: function(){ // This would normally be the result of your Mongo query var itemsArray = [ { "_id": "SXTJBs7QLXoyMFGpK", "Brand": "Nike", "Material": "Cooton", "Price": "67484", "ComboId": "y23", "Color": "White", "LaunchDate": "08/02/2015", "DiscountActiveDate": "08/03/2015", "DiscountInactiveDate": "08/04/2015", "Category": "Sport", "ProductSubCategory": "trackpant", "Status": "Pending", "TemplateID": "557fc7d06ecb48d38a67a380" }, { "_id": "IGJHihljiUYG6787y",...

How do I do an analog of a page scope in variable in Meteor?

meteor,meteor-helper

If you plan to use reactive data among several templates in the same page, I advise you to declare a reactive variable (ReactiveVar()) or a reactive dictionary At the beginning of your js file (if you have several, use the parent template file), outside any template.yourTemplate.rendered or template.yourTemplate.rendered, you declare...

Use JSON file to insert data in database

javascript,json,mongodb,meteor,data

Simple use underscores _.extend function. Like this: var newProfile = _.extend( JSON.parse(Assets.getText('test.json')), {user: id} ) Profiles.insert(newProfile) ...

Passing a parameter into Meteor Template Helper

meteor,spacebars

You cannot call helpers with arguments in an #if. I assume that the template instance's data context is a Unit document because of your use of this._id. If so, can just do; {{#if profile}} {{profile}} {{/if}} The #if checks whether its argument is truthy....

Meteor: onRendered doesn't get fired again after second render iron-route

javascript,meteor,iron-router

onRendered only fires when an instance of the template is added to the DOM, it will thereby not fire again on data changes. If you want to execute code once the data is ready you should use the template.autorun function like so: Template.profielBewerken.onRendered(function () { this.autorun(function (comp) { if (Meteor.user())...

Access binaries inside docker

ubuntu,meteor,docker

It doesn't seem to be configurable at the moment based on this open issue. However, you could always fork the project and modify the start script to use your own custom docker image. If so, make sure you make it: FROM meteorhacks/meteord:base ...