使用角度流星v 0.9
尝试正确加载预先打包的AngularMeteor-SmartAdmin示例应用程序
得到错误:
Error: [ng:btstrpd] App Already Bootstrapped with this Element 'document'
Run Code Online (Sandbox Code Playgroud)
有没有办法弄清楚这个错误发生的原因和位置?
这是我的流星列表:
angular:angular-animate 1.4.0 AngularJS (official) release. For full...
angular:angular-cookies 1.4.0 AngularJS (official) release. For full...
angular:angular-resource 1.4.0 AngularJS (official) release. For full...
angular:angular-route 1.4.0 AngularJS (official) release. For full...
angular:angular-sanitize 1.4.0 AngularJS (official) release. For full...
angularui:angular-ui-router 0.2.15 angular-ui-router (official): Flexibl...
angularui:ui-utils 0.2.4 Angular-ui-utils package for meteor.
autopublish 1.0.3 Publish the entire database to all cli...
cfs:http-methods 0.0.29 Adds HTTP.methods RESTful
gsklee:ngstorage 0.3.0 ngStorage package for …
Run Code Online (Sandbox Code Playgroud) 我是Meteor和AngularJs的新手.我试图按照https://github.com/lvbreda/Meteor_angularjs上的示例应用程序,但到目前为止我还没有能够使它工作.
我在这段代码中收到错误'app is not defined':
app.controller('MeteorCtrl', ['$scope', '$meteor', function ($scope, $meteor) {
Uncaught ReferenceError: app is not defined
$scope.todos = $meteor("todos").find({});
$meteor("todos").insert({
name: "Do something",
done: false
});
Run Code Online (Sandbox Code Playgroud)
我试着重写上面的内容:
var MeteorCtrl = function ($scope, $meteor) {
$scope.todos = $meteor("todos").find({});
$meteor("todos").insert({
name: "Do something",
done: false
})
};
Run Code Online (Sandbox Code Playgroud)
仍然抛出错误'错误:未知提供商:$ meteorProvider < - $ meteor'
https://github.com/bevanhunt/meteor-angular-leaderboard上唯一的另一个米+角度示例似乎已过时.
有人可以使用https://github.com/lvbreda/Meteor_angularjs上的软件包发布一个简单但完全可以下载的meteor + angularjs示例吗?
我正在尝试将我的代码重构为ES6.我正在使用角度流星和ng-table.在重构之前,数据显示在表格中.但是,在重构为ES6语法后,数据不再显示.这是重构代码的片段:
class MyController {
constructor($scope, $reactive, NgTableParams, MyService) {
'ngInject';
$reactive(this).attach($scope);
this.subscribe('myCollection');
this.myService = MyService;
this.helpers({
items() {
return this.myService.getItems();
},
itemTableParams() {
const data = this.getReactively('items');
return new NgTableParams({
page: 1,
count: 10
}, {
total: data.length,
getData: (params) => {
// not called
}
});
}
});
}
}
class MyService {
getItems() {
return MyCollection.find({}, {
sort: {
dateCreated: -1
}
});
}
}
export default angular.module('MyModule', [angularMeteor, ngTable, MyService])
.component('MyComponent', {
myTemplate,
controllerAs: 'ctrl',
controller: MyController …
Run Code Online (Sandbox Code Playgroud) 我正在为角度流星建立一个管理页面.
我已经发布了一个集合中的所有记录:" posts "并且已经订阅了前端的所有记录.
$meteor.subscribe('posts');
Run Code Online (Sandbox Code Playgroud)
在控制器中,如果我从minimongo中选择所有记录的游标,它可以正常工作:
$scope.posts = $meteor.collection(Posts);
Run Code Online (Sandbox Code Playgroud)
但我希望显示分页,所以我想要一次有限的记录,如:
$scope.posts = $meteor.collection(function(){
return Posts.find(
{},
{
sort: {'cDate.timestamp': -1},
limit: 10
}
);
});
Run Code Online (Sandbox Code Playgroud)
它在minimongo中遇到了查询.浏览器挂起了.
" posts "集合仅包含500条记录.当我有200条记录时它工作正常.
任何人都可以给我一个关于我的代码和概念错误的想法吗?
编辑:
好的!当我从查询中评论$ sort行时,它运行正常,如下所示:
$scope.posts = $meteor.collection(function(){
return Posts.find(
{},
{
//sort: {'cDate.timestamp': -1},
limit: 10
}
);
});
Run Code Online (Sandbox Code Playgroud)
但我需要对记录进行排序.那我现在该怎么办?
编辑:
还尝试在sort属性中添加索引,如下所示:
db.Posts.ensureIndex({"cDate.timestamp": 1})
Run Code Online (Sandbox Code Playgroud)
还是同样的问题.
在官方meteor.com网站上的Angular"Todo App"教程中,有以下内容:
$scope.viewModel(this);
Run Code Online (Sandbox Code Playgroud)
在angular-meteor.com上的"Socially"教程中,看起来完全相同的事情是:
$reactive(this).attach($scope)
Run Code Online (Sandbox Code Playgroud)
有什么不同?
我试图通过使用Meteor和Angular.js的组合来获取MongoDb中某个地址的警告
在我的html文件中,我正在做
<div ng-controller = "myController as myCtrl">
{{myCtrl.warnings}}
{{myCtrl.getWarnings("123 Test Street, TestCity, TestState")}}
</div>
Run Code Online (Sandbox Code Playgroud)
在我的app.js文件中:
Warnings = new Mongo.Collection("Warnings");
if (Meteor.isClient) {
var app = angular.module('ffprototype', [ 'angular-meteor' ]);
app.controller('myController', ['$window','$meteor', function($window, $meteor) {
this.warnings = $meteor.collection(Warnings);
this.getWarnings = function(findByAddress){
Warnings.find({address: findByAddress}).fetch();
}
}]);
}
Run Code Online (Sandbox Code Playgroud)
我的mongoDb集合:
{
"_id": "3ixgxEMZDWGtugxA7",
"address": "123 Test Street, TestCity, TestState",
"warning": "Warning 1"
}
{
"_id": "HZH5FvCD5driBYSJz",
"address": "123 Test Street, TestCity, TestState",
"warning": "Warning 2"
}
Run Code Online (Sandbox Code Playgroud)
html网页的输出显示整个警告集合(感谢{{currentDispatch.warnings}}
,但没有显示任何内容{{currentDispatch.getWarnings("123 Test Street, TestCity, …
我刚升级到角度流星1.2.我还升级了角度包.应用程序无法启动.我收到以下错误消息:
**error: conflict: two packages included in the app (angular-templates and templating) are both trying to handle *.html**
Run Code Online (Sandbox Code Playgroud)
当我试图删除它时,我找不到名为'templating'的包.有任何想法吗?
我正在使用Meteor 1.6和AngularJS(Angular 1),并且在我的/server/main.js文件中遇到问题.我想尝试这样导入:
import { FS } from 'meteor/cfs:filesystem';
Run Code Online (Sandbox Code Playgroud)
所以Meteor能够很好地解决它,但问题是,它以某种方式未定义.所以当我这样做时:
Images = new FS.Collection("images", {
Run Code Online (Sandbox Code Playgroud)
我收到上面提到的错误.我一直试图在网上找到答案,我一直在引用Meteor Collection FS文档但是我无法解决我导入的错误.任何人都可以指导我如何解决这个问题?
我正在尝试根据所选类别过滤某些频道.
我有一个ng-repeat channel in channels
有一个ng-if="hasCategory(channel.category)
这是文件:
db.channels.find().pretty()
{
"_id" : "2kj9GK8jE9yHezoWb",
"name" : "example name",
"logo" : "path/to/image.svg",
"number" : 2,
"category" : [
"Broadcast",
"Premium"
],
"tags" : "example tag tags"
}
Run Code Online (Sandbox Code Playgroud)
这是处理ng-if的函数:
$scope.hasCategory = function (categoryNameArray) {
console.log('thisisbeingcalled');
var e = _.indexOf(categoryNameArray, $scope.activeCategory);
if (e === -1) {
return false;
} else {
return true;
}
};
Run Code Online (Sandbox Code Playgroud)
这就是我设置活动类别的方式:
$scope.setCategory = function (name) {
$scope.activeCategory = name;
};
Run Code Online (Sandbox Code Playgroud)
我通过单击视图中的按钮发送:
<section layout="row" layout-align="center center" layout-wrap ng-init="activeIndex; activeCategory">
<md-button …
Run Code Online (Sandbox Code Playgroud) While downloading accounts-base@1.2.11...:
error: certificate has expired
While downloading accounts-password@1.3.0...:
error: certificate has expired
While downloading alanning:roles@1.2.15...:
error: certificate has expired
While downloading aldeed:collection2@2.10.0...:
error: certificate has expired
While downloading aldeed:collection2-core@1.2.0...:
error: certificate has expired
While downloading aldeed:schema-deny@1.1.0...:
Run Code Online (Sandbox Code Playgroud)
甚至尝试设置 NODE_TLS_REJECT_UNAUTHORIZED=0 然后运行meteor。但仍然出现错误。
meteor meteor-blaze meteor-accounts visual-studio-code angular-meteor
angular-meteor ×10
angularjs ×7
meteor ×6
mongodb ×2
ecmascript-6 ×1
javascript ×1
meteor-blaze ×1
minimongo ×1
ngtable ×1
node.js ×1