我来自Angular并且习惯了ui-router的解析功能,这使得它很容易等待并将结果注入控制器.
目前,我希望通过反应来模仿这一点,而无需componentWillMount在使用React Router时在方法中编写请求(或触发操作).我认为有一个更好的方法,我只是没有想出什么.
我很乐意得到一些建议或指出我可以学到的地方
在悬停时是否可以触发父类?我知道它可以用jquery完成,但我想做一个纯粹的CSS解决方案.
我的代码:
.navbar-form{
padding-left: 55px;
.input-group{
width: 200px;
.form-control{
border-right: none;
width: 350px;
&:hover & {
border-color: blue;
}
}
.input-group-addon{
background-color: white;
border-left: none;
}
}
}
Run Code Online (Sandbox Code Playgroud)
FIDDLE:http://jsfiddle.net/fcKyc/
当我专注于它时,期待拥有它input,.input-group-addon会做点什么.input并且图标是输入组的子项.
我有一个使用webpack 2编译资产的同构应用程序.我现在添加了分块,System.import它在webpack端工作但在服务器端没有找到功能.
知道如何解决这个问题吗?
我有一个User模特.
A user有很多integrations.
An integration连接到包含列的profilevia .integration_profilesdata
我想急切加载所有用户的个人资料.
class Integration < ActiveRecord::Base
has_many :integration_profiles
has_many :profiles, through: :integration_profiles
end
class IntegrationProfile < ActiveRecord::Base
belongs_to :integration
belongs_to :profile
end
class Profile < ActiveRecord::Base
has_many :integration_profiles
has_many :integrations, through: :integration_profiles
end
Run Code Online (Sandbox Code Playgroud)
我试过这个:
all = User.first.integrations.includes(:profiles)
Run Code Online (Sandbox Code Playgroud)
但是当我这样做的时候 all.count
=> 2
Run Code Online (Sandbox Code Playgroud)
但是,当我这样做
all = User.first.integrations.joins(:profiles)
all.count
=> the correct total
Run Code Online (Sandbox Code Playgroud)
我应该使用包含还是加入?我一直使用包括所以不确定为什么这不起作用
回到页面时我一直收到错误:
TypeError: Cannot read property 'charAt' of undefined
at Object.Pb.$$parse (chrome-extension://jiflmhpffanabaldnciipnblmfjcjado/bower_components/angular/angular.min.js:86:140)
at chrome-extension://jiflmhpffanabaldnciipnblmfjcjado/bower_components/angular/angular.min.js:90:313
at k.$eval (chrome-extension://jiflmhpffanabaldnciipnblmfjcjado/bower_components/angular/angular.min.js:111:353)
at k.$digest (chrome-extension://jiflmhpffanabaldnciipnblmfjcjado/bower_components/angular/angular.min.js:108:419)
at chrome-extension://jiflmhpffanabaldnciipnblmfjcjado/bower_components/angular/angular.min.js:90:426
at chrome-extension://jiflmhpffanabaldnciipnblmfjcjado/bower_components/angular/angular.min.js:38:222
at Array.forEach (native)
at q (chrome-extension://jiflmhpffanabaldnciipnblmfjcjado/bower_components/angular/angular.min.js:7:280)
at f (chrome-extension://jiflmhpffanabaldnciipnblmfjcjado/bower_components/angular/angular.min.js:38:205)
at chrome-extension://jiflmhpffanabaldnciipnblmfjcjado/bower_components/angular/angular.min.js:31:225
Run Code Online (Sandbox Code Playgroud)
目前正在创建一个chrome扩展,其中angularjs嵌入到页面中.我的content.js文件:
'use strict';
window.addEventListener("load", function() {
if ( window.location.host.match(/(stack|gmail|shopify|magento|zendesk|desk.com|)/) ){
// load the app from all the other dependancies
var app = angular.module('joggle_ecommerce', [
"joggle_ecommerce.controllers",
"joggle_ecommerce.services",
"joggle_ecommerce.directives"
])
.config(function($locationProvider) {
// $locationProvider.html5Mode(true).hashPrefix('!');
})
// find the html and add the angular needed directives
var html = …Run Code Online (Sandbox Code Playgroud) 我一直收到这个错误:
bash: ~/.bash_profile: No such file or directory
Run Code Online (Sandbox Code Playgroud)
这是我的bash_profile:
alias ngrok=/Users/mmahalwy/Desktop/Code/ngrok
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
alias ls='ls -GFh'
function prompt {
local BLACK="\[\033[0;30m\]"
local BLACKBOLD="\[\033[1;30m\]"
local RED="\[\033[0;31m\]"
local REDBOLD="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local GREENBOLD="\[\033[1;32m\]"
local YELLOW="\[\033[0;33m\]"
local YELLOWBOLD="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local BLUEBOLD="\[\033[1;34m\]"
local PURPLE="\[\033[0;35m\]"
local PURPLEBOLD="\[\033[1;35m\]"
local CYAN="\[\033[0;36m\]"
local CYANBOLD="\[\033[1;36m\]"
local WHITE="\[\033[0;37m\]"
local WHITEBOLD="\[\033[1;37m\]"
local RESETCOLOR="\[\e[00m\]"
export PS1="\n$RED\u $PURPLE@ $GREEN\w $BLUE[\#] ? $RESETCOLOR"
export PS2="| ? $RESETCOLOR"
}
# prompt
export PATH=/usr/local/bin:$PATH
source ~/.git-completion.bash
if [ -f `brew --prefix`/etc/bash_completion ]; then …Run Code Online (Sandbox Code Playgroud) 有一个关于如何使用博客吨和职位bind()以及它是如何不同于call()和apply(),但目前还非常小的例子,当或为什么我应该使用bind()
我发现给出的许多例子非常罕见,例如:
"use strict";
function Person(firstName, lastName){
this.firstName = firstName
this.lastName = lastName
}
Person.prototype.say = function(message){
return '[' + this + ']: ' + this.firstName + ' ' + this.lastName + ' said: "' + message + '"'
}
Person.prototype.toString = function(){
return '[Person]'
}
moe = new Person("Mo", "El")
func = moe.say.bind(moe)
console.log(func("asdasda"))
Run Code Online (Sandbox Code Playgroud)
我不知道什么时候我想让函数等于某个其他变量并使用该变量而不是原始函数,更不用说该变量等于Person对象实例的绑定.
有什么好例子吗?
我有方法:
export const groupActivities = ({ activities, tags, images, tickets }) => {
if (!activities || !tags) {
console.error('Must have activities and tags');
}
const groupActivities = Object.assign({}, activities);
const groups = groupByTags({ activities: groupActivities, tags });
groups.forEach(group => {
group.length = group.activities.length;
console.log(group.length);
group.activities.forEach(activity => {
if (images) {
activity.images = activity.imageIds.map(id => images[id]);
}
if (tickets) {
console.warn('No tickets provided to the groupactivities helper. May cause problems.');
activity.tickets = activity.ticketIds.map(id => tickets[id]);
}
});
});
return groups;
}; …Run Code Online (Sandbox Code Playgroud) 无法尝试重新编译角度应用程序.
调用angular.bootstrap后有没有办法解除引导?
一旦我在已经引导的情况下执行angular.bootstrap,就会导致错误
谢谢!
rake db:migrate每次播种时我都会出错。我不想迁移,因为它由于在我的数据库中查找尚不存在的表而失败。我怎么能忽略这个并继续种子?
mmahalwy @ ~/Desktop/Code/API [56] ? rake db:seed
You have 4 pending migrations:
20141206123759 AddEsAnalyzerColumnToLanguageTable
20141213090426 CreateTextFontView
20141213090434 UpdateLemmaAndStem
20141230124205 ChangeTextFontView
Run `rake db:migrate` to update your database then try again.
Run Code Online (Sandbox Code Playgroud)
注意:我有一个structure.sql文件,其中包含用于创建表和从 yml 播种数据的所有 sql 命令。我的迁移目前需要在数据/表在数据库中之后运行。