理想情况下,当我点击按钮(位于顶部的Ionic导航栏中)时,它应该将我带到另一页.然而它不起作用.点击后,导航栏按钮全部消失.
当我使用虚拟代码时,它有效; 警报出现.但是当我将它交换到实际代码时,它无法工作.
我对控制器代码以及如何引用URL或视图感到有些不适.但是使用href和ui-sref进行测试也无法产生任何结果.Google Devt Tools(JS控制台)和Batarang也没有显示任何内容.
有人能告诉我的方式吗?
虚拟HTML代码
<button class="button button-icon ion-compose" ng-click="create()"></button>
Run Code Online (Sandbox Code Playgroud)
js文件中的虚拟控制器代码
$scope.create = function() {
alert("working");
};
Run Code Online (Sandbox Code Playgroud)
实际的HTML代码(我试过所有4个版本)
<button class="button button-icon ion-compose" ng-click="create('tab.newpost')"></button>
<button class="button button-icon ion-compose" ui-sref="tab.newpost"></button>
<button class="button button-icon ion-compose" href="/tab/newpost"></button>
<button class="button button-icon ion-compose" ng-click="location.path('/tab/newpost')"></button>
Run Code Online (Sandbox Code Playgroud)
控制器文件(Post和Auth依赖项工作正常).当我尝试将URL放在.go()和function()中时,应用程序失败.
app.controller('NavCtrl', function ($scope, $location, $state, Post, Auth) {
$scope.post = {url: 'http://', title: ''};
$scope.create = function() {
/* $location.path('/tab/newpost'); */ /* this variant doesnt work */
$state.go("/tab/newpost");
};
});
Run Code Online (Sandbox Code Playgroud)
状态js文件的摘录
.state('tab.newpost', {
url: '/newpost',
views: {
'tab-newpost':{ …
Run Code Online (Sandbox Code Playgroud) 我使用Easy-Search包,想要搜索帖子(或评论那些帖子).
问题:输入搜索时没有显示任何内容.在console.log和server上都没有显示错误消息.
更新:我在发布和订阅上都做了console.log.因此,subscribe返回浏览器devtools上的console.log,但发布不会返回服务器终端上的任何内容.
模板html
<template name="searchPosts">
{{> esInput id="main" index=indexes placeholder="Search.." }}
{{#esEach index="posts"}}
{{> postItem}}
{{/esEach}}
{{#esEach index="comments"}}
{{> postItem}}
{{/esEach}}
</template>
Run Code Online (Sandbox Code Playgroud)
模板js - 客户端
Template.searchPosts.onCreated(function () {
var self = this, instance;
instance = EasySearch.getComponentInstance(
{ id: 'main', index: 'posts'},
{ id: 'main', index: 'comments'}
);
instance.on('searchingDone', function (searchingIsDone) {
searchingIsDone && console.log('I am done!');
});
instance.on('currentValue', function (val) {
console.log('The user searches for ' + val);
});
this.subscribe("allDocs");
});
Template.searchPosts.helpers({
indexes : function () …
Run Code Online (Sandbox Code Playgroud) 对于数据库和搜索来说,我是一个新手,所以请耐心等待.我试图在Meteor应用程序中实现搜索功能.我已经通过大气检查并偶然发现了这4个选项.
我的需求是简单搜索,能够处理可能具有数据嵌套的更大数据集.例如一个任务,可能有评论或链接等.(全文和超过正则表达式查询将是好的)
我读到,为了便于搜索,即使使用某种形式的弹性或Mongodb应用程序,似乎只应用于单个Mongo集合?例如,如果我想搜索
Dinosaurs = new Meteor.Collection('dinosaurs');
并且
Mammals = new Meteor.Collection('mammals');
?
对以上4个选项的优缺点有任何建议吗?1似乎相对容易实现,但我不知道这里使用弹性引擎意味着什么.如果我要实现弹性,我该如何在Meteor中实现呢?它与实现Elasticsearch HTTP API有何不同?
同样,对于搜索源,它支持弹性过这里.老实说,我对这些差异一无所知.
错误发现在2个文件的第1行中: - controllers.js - app.js
下面附有html.
当我启动本地服务器时,该应用程序会出现,但在输入我的详细信息后,我无法通过单击注册按钮登录或注册.这是404错误吗?
我还尝试将这两行添加到index.html文件中(我认为是我没有定义的一些项目)但是没有用.
index.html文件
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
*<!-- ionic/angularjs js -->*
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="https://cdn.firebase.com/v0/firebase.js"></script> <!-- firebase -->
<script src="https://cdn.firebase.com/libs/angularfire/0.5.0/angularfire.min.js"></script> <!-- angularfire -->
<script src="https://cdn.firebase.com/v0/firebase-simple-login.js"></script> <!-- firebase-simple-login -->
*<!-- cordova script (this will be a 404 during development) -->*
<script src="cordova.js"></script>
<!-- app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
</head>
<body ng-app="bucketList" animation="slide-left-right-ios7">
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon …
Run Code Online (Sandbox Code Playgroud) 我试图<div>
在{{#each}}周围插入容器,但它也没有用.它也很奇怪,因为它适用于2个普通帖子列表页面,但不适用于按距离对它们进行排序的第3个页面.
更新:
我注意到后,我从改变模板JS template.name.onRendered
来onCreated
,分拣页的作品.但是,只有从先前的帖子列表页面而不是从个人资料页面开始,它才有效.
错误页面的唯一共同点是那些页面使用publishComposite进行排序.这可能是问题,因为publishComposite有一个子到父关系?
错误消息
Exception in queued task: Error: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
at Error (native)
at Object.container._uihooks.insertElement (http://localhost:3000/packages/meteoric_ionic.js?e45c114e85716d9fad8bac1cd7904ae2700bc963:5750:19)
at DOMRange._insertNodeWithHooks (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:383:21)
at Function.Blaze._DOMRange._insertNodeWithHooks (http://localhost:3000/packages/peerlibrary_blaze-components.js?4eddb4e3f0f660190548347e680d109a51a7050f:2377:10)
at Function.DOMRange._insert (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:354:16)
at DOMRange.attach (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:431:16)
at Blaze._DOMRange.attach (http://localhost:3000/packages/peerlibrary_blaze-components.js?4eddb4e3f0f660190548347e680d109a51a7050f:2437:33)
at Function.DOMRange._insert (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:349:7)
at DOMRange.attach (http://localhost:3000/packages/blaze.js?695c7798b7f4eebed3f8ce0cbb17c21748ff8ba8:431:16)
at Blaze._DOMRange.attach (http://localhost:3000/packages/peerlibrary_blaze-components.js?4eddb4e3f0f660190548347e680d109a51a7050f:2437:33)
Run Code Online (Sandbox Code Playgroud)
meteoric_ionic js文件引用第19行
container._uihooks = {
insertElement: function(node, next) {
var …
Run Code Online (Sandbox Code Playgroud) 这是来自Google Devt Tools的错误.有谁知道这个问题?我尝试在app.js文件中多次更改,包括文件结构和stateProvider(没有控制器),但它似乎不是问题.(脚本包含在app.js中,文件名和目录正确)
另外,我的注销和submitPost按钮也不起作用.
newpost.html
<div class="modal slide-in-up" ng-controller="NavCtrl">
<!-- Modal header bar -->
<header class="bar bar-header bar-secondary">
<button class="button button-clear button-primary" ng-click="close()">Cancel</button>
<h1 class="title">New Shout</h1>
<button class="button button-positive" ng-click="submitPost()">Done</button>
</header>
<!-- Modal content area -->
<ion-content class="padding has-header">
<form class ng-submit="submitPost()" ng-show="signedIn()">
<div class="form-group">
<input type="text" class="form-control" placeholder="Title" ng-model="post.title">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Link" ng-model="post.url">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</ion-content>
</div>
Run Code Online (Sandbox Code Playgroud)
controller.js文件
app.controller('NavCtrl', function ($scope, $firebase, $location, Post, Auth, $ionicModal) {
$scope.post = {url: 'http://', …
Run Code Online (Sandbox Code Playgroud) 我有这个错误,但它没有指定哪个代码行有问题.有什么方法可以缩小我需要关注的代码吗?
不确定它是否是一个相关的问题,但是当我提交一个doc并且它应该识别我的时候user.username
,但是当html显示时它就会出现空白{{author}}
.
集合的代码(公共/服务器的共享文件夹)如下:
var post = _.extend(postAttributes, {
userId: user._id,
author: user.username
});
Run Code Online (Sandbox Code Playgroud)
感谢任何帮助!
更新:
将UserAccount代码转移到服务器文件夹后出现新的错误消息.
Exception while simulating the effect of invoking 'postInsert'
"Match error: Unknown key in field message"
javascript ×7
meteor ×4
angularjs ×3
html ×2
collections ×1
jquery ×1
meteor-blaze ×1
meteoric ×1
mongodb ×1
node.js ×1
search ×1