我有一个简单的对象文字,其地址如下所示
address: {
country: String,
state: String,
city: String,
zip: String,
street: String
}
Run Code Online (Sandbox Code Playgroud)
它的内部是一个我用express.js渲染函数传递的对象.
在我的模板页面中,我正在尝试在此对象内循环,如下所示:
<% for (var prop in artist.address ) { %>
<%- artist.address[prop] %>
<% } %>
Run Code Online (Sandbox Code Playgroud)
它输出数据但包含ejs函数,如下所示:
function () { return this.get(path); } function () { return this.get(path); } yafo 09988 jerusalem israel israeli [object Object] undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined [object Object] [object Object] function () { var self = this , hookArgs // arguments …Run Code Online (Sandbox Code Playgroud) 我有一个寻找帖子的简单邮政路线_id.问题是pathFor助手创建了这样的路径:
ObjectID("52e16453431fc2fba4b6d6a8")
Run Code Online (Sandbox Code Playgroud)
我猜mongoDB插入已被更改,现在该_id对象在其中包含另一个对象调用_str.
这是我的路线:
this.route("post", {
path: "/post/:_id",
waitOn:function(){
NProgress.start();
Meteor.subscribe("Teams");
},
before: function () {
NProgress.done();
},
data: function () {
return Posts.findOne({_id: this.params._id});
}
});
Run Code Online (Sandbox Code Playgroud)
目前,它创建了一个href像:
post/ObjectID("52e16453431fc2fba4b6d6a8")
Run Code Online (Sandbox Code Playgroud)
点击它打开一个网址
post/ObjectID("52e16453431fc2fba4b6d6a8")
Run Code Online (Sandbox Code Playgroud)
但是,我得到了"NotFound"模板而不是帖子.
我怎样才能解决这个问题?
好的,所以我使用该命令构建了一个流星应用程序
meteor build bundle --debug --server https://(my app url hosted on meteor)
Run Code Online (Sandbox Code Playgroud)
meteor确实用cordova android包和tar.gz文件构建了一个bundle文件夹.
在构建应用程序后,即时尝试点击
meteor
Run Code Online (Sandbox Code Playgroud)
但我得到一堆错误:
While Building the application:
bundle/android/project/cordova/lib/android_sdk_version.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/appinfo.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/build.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/check_reqs.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/clean.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/device.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/emulator.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/exec.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/log.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/run.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/lib/spawn.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/node_modules/shelljs/scripts/generate-docs.js:1:15: Unexpected token ILLEGAL
bundle/android/project/cordova/node_modules/shelljs/scripts/run-tests.js:1:15: Unexpected token ILLEGAL
bundle/android/project/assets/www/application/head.html:1: bad formatting in HTML template
bundle/android/project/assets/www/application/index.html:1: …Run Code Online (Sandbox Code Playgroud) 好吧我正在使用Facebook API图表当用户使用Facebook登录时获取用户朋友列表+朋友图片:
Template.user_loggedout.events({
"click #fb": function (e, tmp) {
Meteor.loginWithFacebook({
requestPermissions: ['user_likes',
'friends_about_me',
'user_birthday',
'email',
'user_location',
'user_work_history',
'read_friendlists',
'friends_groups',
'user_groups']
}, function (err) {
if (err) {
console.log("error when login with facebook " + err);
} else {
FB.api('/' + Meteor.user().services.facebook.id + '/friends', { fields: 'name,picture' }, function (response) {
if (response && response.data) {
friends = response.data
}
})
}
});
}
Run Code Online (Sandbox Code Playgroud)
正如预期的那样,我得到朋友阵列里面有对象(表示为朋友).在某些时候,当用户点击链接时我想向用户显示他的朋友列表.所以我得到了这个HTML:
Template.add_friends.helpers({
friends_list: friends
});
template name="add_friends">
<div class="friends_Page">
{{#each friends_list}}
<li>{{name}}</li>
{{/each}}
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
问题是,在应用程序启动后以及用户使用Facebook单击登录按钮时,friends对象会更新.那么当我从facebook graph …
我有一个名为map.html的页面,它是一个使用google maps api的简单html:
<head>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=XXXXXXX&sensor=true®ion=IL">
</script>
<script src="map.js" type="text/javascript"></script>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
</head>
<body>
</body>
<template name="map">
<div id="map-canvas"></div>
</template>
Run Code Online (Sandbox Code Playgroud)
和我使用铁路由器,路由到这个页面:
this.route("map");
Run Code Online (Sandbox Code Playgroud)
还使用pathFor:
<a href="{{pathFor 'map'}}" class="map"><div class="inner">set location</div></a></div>
Run Code Online (Sandbox Code Playgroud)
最后我的谷歌地图初始化函数,该函数位于名为map.js的sperate文件中:
$(document).ready(function () {
function initialize() {
var TLV = new google.maps.LatLng(32.06461, 34.777222);
var mapOptions = {
zoom: 12,
center: TLV,
panControl: false,
zoomControl: false,
mapTypeControl: true,
scaleControl: false,
streetViewControl: false,
overviewMapControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
marker = new google.maps.Marker({
position: TLV, …Run Code Online (Sandbox Code Playgroud) 我是PhoneGap的新手,我试图安装和工作作为起始指南显示,但它如此复杂......
所以这是我的问题:
但
当我尝试创建一个项目时,它说:
我该怎么办?
我做了一个小测验,但我在单击下一步按钮时遇到了最后一个问题,它会检查该值是否未找到。如果它是真的,它会检查客户选择的收音机是否等于配偶的正确答案,然后 var correctAnswer 获得 +1。问题在于,在第一个问题中它起作用(检查客户是否真的从答案中选择了一些内容并检查其是否正确)但是当提出下一个问题时它不起作用。我试图弄明白,但没有sulotion来......还要检查的jsfiddle:http://jsfiddle.net/boazmier/ru8Qj/1/ 我试图把checkClientChoice功能到loadquestion功能它没有工作,以及
var allQuestions = {
question: {
question0: {
question: "Who is the first Prime Minister of Israel?",
choices: ["David", "Rabin", "Peres", "Bibi"],
correct: "David"
},
question1: {
question: "What Is israel date of birth?",
choices: ["1948", "1958", "1950", "1944"],
correct: "1948"
},
question2: {
question: "What is PhoneGap framework for?",
choices: ["apache", "apps", "server", "client"],
correct: "apps"
}
},
correctAnswer: 0
};
var allquestion = allQuestions["question"];
var calcAnswers =allQuestions["correctAnswer"];
var qNum = 0; …Run Code Online (Sandbox Code Playgroud) meteor ×4
javascript ×3
cordova ×2
iron-router ×2
android ×1
build ×1
ejs ×1
express ×1
for-loop ×1
google-maps ×1
input ×1
java ×1
jquery ×1
mongodb ×1
node.js ×1
radio-button ×1
rendering ×1
routes ×1
templates ×1