w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » METEOR » Page 1
Accounts-ui change text
What kind are '#login-sign-in-link' and '.login-close-text'? Are those inputs? If so, use rather .val('text') Quoting documentation: The .text() method cannot be used on input elements. For input field text, use the .val() method.

Categories : Meteor

Meteor is saving images correctly but I can't retrieve them
Don't forget to publish your images collection if you're removed auto publish. Server: Meteor.publish("images", function() { return Images.find(); //Narrow this down to the images that should be viewable }); Then on the client: Meteor.subscribe("images");

Categories : Meteor

Update count for external link
A little modification: <a href="{{url}}" target="_blank" class="tracked">{{title}}</a> Then you could use: Template.body.events({ 'click a.tracked' : function(e) { var href = $(e.currentTarget).attr('href'); ClickedLinks.insert({href: href, when: new Date()}); } }); Where ClickedLinks is a collection. The main idea is that we track all click events

Categories : Meteor

How to Connect Meteor Server to External Websocket / Socket IO API?
I created a new Meteor package joncursi:socket-io-client to solve this problem. Please see https://atmospherejs.com/joncursi/socket-io-client for more detail and example usage. Since I've bundled the NPM binaries into a package, so you won't have to worry about installing NPM packages, declaring NPM.require() dependencies, etc. And best of all, you can deploy to .meteor.com without a hitch.

Categories : Meteor

Laika vs Velocity on meteor TDD
This is probably not an appropriate question for SO, but I struggled with this myself so I'll share my experiences and thoughts. First, Velocity is not a testing framework in itself. It's really a framework for testing frameworks. It provides unified reporting and execution management. You don't just use Velocity; you use the testing frameworks it supports, currently: sanjo:jasmine, mike:mocha, a

Categories : Meteor

Porting ionic sidemenu project to meteor
Create both projects: ionic start ionicProject sidemenu meteor create meteorProject Reorganise the files: All the important files within a ionicframework comes into a www folder start to reorganise them to fit with the meteor good practices. In the meteor root folder, create a client, server, css, and public folder Copy the ionicProject/www/css files into the meteorProject/css Copy a

Categories : Meteor

Googlebot returns with AJAX temporarily unreachable in Meteor Js Application
If you see sockjs/info?cb=xxx as an error, spiderable isn't working. Spiderable is a bit quirky when it comes to debugging. There are some weird issues, so make sure: If you use select2 make sure you use a version without the accented characters. Which spiderable is not compatible with (bit odd). Use a compatible package from atmosphere that have these removed. If you use ssl check that your ce

Categories : Meteor

Cannot use variable returned from method call()
You have to use either Session or Collection, You can set the Session variable from the callback method OR Store the data to collection and use that collection to show them on the client-side

Categories : Meteor

Meteor routing filter not working
Meteor.user() doesn't take any arguments. You probably want: if (Meteor.user() && Meteor.user().admin) { // admin } else { // access denied } I also suspect that passing the admin option to Accounts.createUser doesn't do anything. On the server, you could do var userId = Accounts.createUser followed by Meteor.users.update(userId, {$set: {admin: true}});.

Categories : Meteor

Meteor as a client-side only framework (with a custom back-end)
There is stand-alone Blaze which is Meteor's front-end rendering engine. The current distribution is a bit dated and includes a lot of things you might not need: minimongo, deps, jquery, underscore. If you want to assemble a set of Meteor packages manually, you can follow this: $ meteor create dummy-app $ cd dummy-app $ meteor add iron:router percolate:momentum # ... put packages you want to use

Categories : Meteor

iron:router will not re-render after route change with same template
You can try something like this: Router.configure({ layoutTemplate: 'mainLayout' }); Router.route('/list', { name: 'list', template: 'listTemplate', action: function() { this.state.set('query', this.params.query); } }); Router.route('/find', { name: 'find', template: 'listTemplate', data: function() { return this.params.query; }, action: function() { this.state.s

Categories : Meteor

MeteorJS - How to prevent anonymous clients from Subscribing to a collection?
You can restrict the subscriptions to logged in users from the server side, as follows: From Meteor & Security: Setting the Record Straight by Sacha Greif: Only publish posts if a user is logged in: Meteor.publish('posts', function() { if(this.userId){ return Posts.find(); } }); In your case you need to change posts to books, properly capitalized to match other code. This wil

Categories : Meteor

Swiper with Meteor
Instead of Meteor.startup(function(){... Use; Template.gallery.onRendered(function(){ .... The DOM is not populated with all the div's at startup, that only happens after the template has been rendered with the data from {{#gallery_images}} and not until then can you new the Swiper class

Categories : Meteor

Meteor OAuth API Login
OK so I figured it out: serviceData add ID to it and it works! var serviceData = { id: identity.data.id, email: identity.data.email, username: identity.data.login, accessToken: accessToken, expiresAt: (+new Date) + (1000 * response.expiresIn) };

Categories : Meteor

How do I show loading templates for with routes with multiple subscriptions when using iron router 1.0 on meteor?
You've to use the property this.ready(), check this example from Iron Router documentation: https://github.com/EventedMind/iron-router/blob/devel/examples/waiton/waiton.js

Categories : Meteor

iron:router Meteor how to change route (save state in history) without changing the url
I'm not sure I understand your question 100%. But it sounds like you want to set a session variable to a specific value based off of a specific route to control the state of an overlay? If that's the case, your best bet would be to use an onBeforeAction hook. Here's how you could do that with a Route Controller: PostController = RouteController.extend({ waitOn: function () {}, data: functi

Categories : Meteor

Meteor Objects Are Undefined Why?
Where are you getting "rowData.Title" from? rowData appears to be an array, not an object. And the property title does not even exist in the nested objects. But I think I know what you're trying to do. It looks like you either just need to store the data by iterating over the array, or render it differently in your template. If each one of those object literals in your array is a product, th

Categories : Meteor

Inserting text at specific point in a list generated using #each
You could probably use helper that will check if year is the same as in the last record, if not - he will output it, something like <template name="Entry"> {{year}} {{data}} </template> And in js year: function(){ //operations that will return year to some variable, for example year_variable if(global_variable===undefined){ global_variable=year_variable; return ye

Categories : Meteor

Proper way to handle multiple "pages" in meteor
There are several ways to handle multiple pages in meteor 1.iron-router using iron router you can create a layout template and inject all other templates inside it using {{> yield}}. Check the iron-router guide to know more about layout template. 2.{{> Template.dynamic}} if you do not want to add iron-router you can use {{> Template.dynamic}} to achieve the same. <body> <ul

Categories : Meteor

Access Template.TemplateName.helpers from Template.helpers and vice versa
Have you considered defining a global method instead? Instead of registering with Meteor Templates, just define it as globalHelperFunc = function(templateVar) { // do work } Note that this need to be in "lib" folder, so maybe (/lib/helpers.js) Reference: Global function for Meteor template helper

Categories : Meteor

Meteor: what are the best settings in a production environment?
Have you taken a look at meteor up yet? It will set up a production quality server for you. I've used it for several production applications and it works great. As far as adding/removing packages goes, I've never ran into any problems with installed packages running on production. A couple of my apps have about a dozen or so packages installed. But if you suspect that a package might be causing t

Categories : Meteor

iron router: is it a good idea to subscribe a collection in onBeforeAction?
Maybe you could try the Subscriptions Manager for Meteor : https://github.com/meteorhacks/subs-manager It's supposed to let you cache some subs to be more responsive. Did you try to use kadira to trace more your subscriptions ?

Categories : Meteor

How to create an dynamic input list without creating a db collection
Most users probably don't need to directly use Tracker.Dependency anymore because there are now higher-level options that are are a bit easier to use. Here are two choices: Client Collections You can declare a client-side collection like: InputOptions = new Mongo.Collection(null); It will have all of the same behavior as a normal collection without trying to sync its data to the server. This

Categories : Meteor

Meteor.js - what is the most convenient way to update a user profile?
Meteor.user() is a document, not a cursor. It's actually an alias for Meteor.users.findOne(this.userId). You can either do so via a method call (server), or directly on the client. Method call way: //server code Meteor.methods({ updateProfile : function(newProfile) { if(this.userId) Meteor.users.update(this.userId, {$set : { profile : newProfile }}); } }); And on the client: Me

Categories : Meteor

Profiling data for Meteor application
Of course it is possible, Kadira has done just that. There is also meteor-analytics package, more info on that in this video.

Categories : Meteor

How can we use latency compensation when the meteor method on server can fail?
One solution is to use a spinner-like indicator if the server roundtrip call takes more than X milliseconds, suggesting that the display is to be treated as "interim". If and when the server method call does return, the indicator could turn into a ✔ checkmark. That's why Meteor has a feature called method stubs. If you define a method on the client with the same name as a server method, Mete

Categories : Meteor

How can I make template data dynamic/reactive?
The problem is that setting a non-reactive variable won't cause the template helper to rerun. You can fix this by attaching a ReactiveVar to your template instance like so: Template.item.created = -> @isDisabled = new ReactiveVar false Template.item.events 'click #disable': (e, template) -> template.isDisabled.set (not template.isDisabled.get()) Template.item.helpers isDisabled:

Categories : Meteor

What is the iron:router 1.0 equivalent of this.setLayout() and this.lookupLayoutTemplate()?
this.setLayout is now this.layout(). this.lookupLayoutTemplate is now Router.lookupLayoutTemplate Also take note that onBeforeAction now has three arguments: Router.onBeforeAction(function(req, res, next) { next(); // or this.next(); // still the same as pause().. // you MUST call next so the route renders. });

Categories : Meteor

Public static assets in module folders?
Unfortunately the only way to do it is to use a package. You can add static assets to a package, and the file can be accessed with the URL: /packages/[package name]/[path to file]. Here's an example of a package.js for hopscotch: Package.describe({ summary: 'A framework to make it easy for developers to add product tours.' }); Package.onUse(function(api) { api.versionsFrom('1.0.0'); api.ad

Categories : Meteor

Meteor app "breaks" when deployed (wrong login parameters, gets stuck in requests)
Ok, it was an insanely stupid mistake on my part: The mongodb was still in an older state and caused a conflict. If you have problems deploying your meteor app try meteor deploy myapp.meteor.com -- delete This will delete all resources on the server, including the database. Then do a simple meteor deploy myapp.meteor.com

Categories : Meteor

Meteor: what code goes on the client side and server side?
if create a directory named client that goes only to client. if you create a directory named server that goes only to server. every thing else you code goes to client and server both. (even if you use Meteor.isServer check) you can read more about directory structure here.

Categories : Meteor

'Or' condition in Meteor.js template blocks
Meteor using spacebar which is based on handlebars. In handlebars, there are now direct way for logical operators. You can do small workaround to handle the or by creating a Template.helper Template.registerHelper("equals_or", function(param, arr) { arr = arr.split(","); if (arr.indexOf(param) !== -1) { return true; } else { return false; } }); Then in the HTML you c

Categories : Meteor

Understanding how Router.go() works in Meteor
Good question - I also found this confusing when I first saw it. Here's a sketch of what's going on: The router parses /posts/:_id and figures out that it should be passed a context object which contains an _id field. You call Router.go with a context object that contains an _id field. The router takes your context object and copies the value of _id into this.params. Because the router underst

Categories : Meteor

blog name in url instead of id in meteor
One idea could be to have a link on the template like for example: <a href="/blog_post_name"></a> Now in iron:router Router.map("blogpost",{ path:"/blog/:slug", template:"singlepost", waitOn: function () { return [Meteor.subscribe('blog')]; }, data: function(){ return blog.findOne({name: this.params.slug});//want to return single blog

Categories : Meteor

Meteor Sass using base sass from deeper files
If you're using the fourseven:scss package to compile the Sass in your Meteor project, you simply need to prefix the filenames of your imported .scss files with an underscore, which is the standard method of naming a partial stylesheet with Sass. In your case, your folder and file structure should be changed to: .meteor client dashboard _dashboard.scss client.scss And then you

Categories : Meteor

Meteor Template events, Showing error "Template not define"
You should move the Template code inside client block and also creating individual helpers is deprecated. Use helpers block instead. if (Meteor.isClient) { Template.main.helpers({ users: function() { return UserInfo.find(); } }); Template.main.events({ 'click #add': function () { var names = $('#names').val(); var city = $('#city').val(); var email = $('#email').val();

Categories : Meteor

Meteor make user defined HTML or SVG reactive
The following topic was very similar to my questions and it got me a good start and I figured it out and posted and answer there. How to make meteor evaluate user defined template text

Categories : Meteor

Meteor 1.0 - why does "Building the application" take so much longer than it used to?
As Werner pointed out, you are describing the issue #2846 (https://github.com/meteor/meteor/issues/2846). They are working hard to getting this fixed to make rapid testing more enjoyable again.

Categories : Meteor

userId vs Meteor.userId vs Meteor.userId()
Digging into the docs, it seems userId is just the default name given to the first argument of allow() and deny() methods. It could just as well be written like this: Posts.allow({ insert: function(theUser, doc) { // only allow posting if you are logged in return !! theUser; } });

Categories : Meteor




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.