小编Chr*_*end的帖子

AngularJS指令中的动画,事件未触发

我正试图在指令中的'enter'事件之后做一些事情.加载模板时,事件未触发.

这是应用声明

angular
  .module('MyApp', [
    'ngAnimate',
    'ngCookies',
    'ngResource',
    'ngRoute',
    'ngSanitize',
    'ngTouch'
  ])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/home.html',
        controller: 'HomeCtrl'
      })
      .when('/in-the-community', {
        templateUrl: 'views/in-the-community.html',
        controller: 'CommunityCtrl'
      })
       .otherwise({
        redirectTo: '/'
      });
  });
Run Code Online (Sandbox Code Playgroud)

最初我使用路由提供程序给我一个模板页面.然后我尝试在这些模板中使用指令来提供另一个视图.这可以在我的模板页面中使用以下内容

<div class="flex">
    <div class="fc fci image-wrapper" id="home-banner">
    </div>

    <div class="fc fcc">
        <section show-and-hide-content="{{ sub_content }}">
        </section>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

这将在以下指令中加载

angular.module('rubisApp')
  .directive('showAndHideContent', function ($animate) {
    return {
      templateUrl: 'views/community-sub.html',
      controller: 'CommunitySubCtrl',
      link: function(scope, element, attributes) {
        $animate.on('enter', element,
           function callback(element, phase) {
             console.log('attributes.showAndHideContent');
           }
        ); …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

13
推荐指数
1
解决办法
190
查看次数

JPGraph 4&3.5 - 当一条线出现在条形图上方时,它会在稍微不同的位置呈现两次.为什么?

在创建Bar Plot顶部有一条线的图形时,JPGraph版本4和3.5似乎存在问题.该线似乎在稍微不同的位置呈现两次.如果我将库恢复到版本3,它将解决问题.我目前正在与他们的支持团队调查此问题.

这是生成图表的代码

$graph = new Graph($w, $h, 'auto');

$graph->SetScale("textint", 0,10);
$graph->SetMargin(0,0,0,0); // left, right, top, bottom.
$graph->SetMarginColor('white');
$graph->SetBox(false);
$graph->SetFrame(false);
$graph->SetY2OrderBack(false);
$graph->img->SetAntiAliasing(false);

$graph->yaxis->SetTickPositions([0,2,4,6,8,10]);
$graph->yaxis->HideLabels();
$graph->xaxis->HideLabels();
$graph->xaxis->SetTickLabels( ['2012', '2013', '2014', '2015'] );
$graph->xaxis->SetLabelAlign('center','center');

$graph->ygrid->SetFill(true,'#f3f3f4','#ffffff');
$graph->ygrid->Show();

$colour_one = $this->colors['blue_dark'];
$colour_two = $this->colors['blue'];
$line = $this->colors['line'];

$barplot = new BarPlot($bars);
$graph->Add($barplot);

$barplot->SetFillColor(array($colour_one, $colour_one, $colour_one, $colour_two));
$graph->SetColor($this->colors['text']);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

$group_standard = new LinePlot($lines[0]);
$group_standard->SetBarCenter();

$graph->Add($group_standard);
$group_standard->SetStyle('dashed');
$group_standard->SetColor($line);

$twenty_fifteen_target = new LinePlot($lines[1]);
$twenty_fifteen_target->SetBarCenter();
$twenty_fifteen_target->SetStyle('solid');
$twenty_fifteen_target->SetColor($line);

$graph->Add($twenty_fifteen_target);

$graph->Stroke(storage_path().'/audit-generator/images/graphs/' . $name . '.png');
Run Code Online (Sandbox Code Playgroud)

要访问演示,请访问 …

php jpgraph

12
推荐指数
0
解决办法
295
查看次数

Laravel save()方法返回true但不更新记录

我正在使用Eloquent来更新我的桌子机会,

机会模型

<?php namespace App;

use Illuminate\Database\Eloquent\Model;

class Opportunity extends Model {

protected $primaryKey = 'OpportunityID';

protected $table = 'opportunitys';
// relationships
public function csfs()
{
    return $this->hasMany('App\Csf', 'opportunityID');
}

public function benefits()
{
    return $this->hasMany('App\Benefit', 'opportunityID');
}

public function risks()
{
    return $this->hasMany('App\Risk', 'opportunityID');
}

public function projects()
{
    return $this->belongsTo('App\Project', 'projectID');
}

public static function createNewOpportunity($input, $projectID)
{
    $opportunity = new Opportunity;
    $opportunity->value = $input['value'];
    $opportunity->margin = $input['margin'];
    $opportunity->duration = $input['duration'];
    $opportunity->tender_type = $input['tender_type'];
    $opportunity->likelihood_of_success = $input['likelihood_of_success'];
    $opportunity->scope_of_work …
Run Code Online (Sandbox Code Playgroud)

php laravel eloquent laravel-5

10
推荐指数
1
解决办法
1万
查看次数

Laravel 5身份验证器

我正在尝试实现社交网站,但我收到了与身份验证器类相关的错误.我的应用程序找不到它.

这是我控制器中的代码

<?php namespace App;

use Illuminate\Contracts\Auth\Authenticator;
use App\Repositories\UserRepository as UserRepository;
use Laravel\Socialite\Contracts\Factory as Socialite;

class AuthenticateUser {

    private $users;
    private $socialite;
    private $auth;
        public function __construct(UserRepository $users, Socialite $socialite, Authenticator $auth)
    {
        $this->users = $users;
        $this->socialite = $socialite;
        $this->auth = $auth;
    }
    public function execute($hasCode)
    {
        if ( ! $hasCode ) return $this->getAuthorisationFirst();

        $user = $this->socialite->drivers('google')->user();

        dd($user);
    }

private function getAuthorisationFirst()
{
    return $this->socialite->driver('google')->redirect();
}

}
Run Code Online (Sandbox Code Playgroud)

我收到的错误是

Container.php第833行中的ReflectionException:类Illuminate\Contracts\Auth\Authenticator不存在

php laravel laravel-5

2
推荐指数
1
解决办法
1448
查看次数

Laravel"小于"查询未显示预期结果

我正在尝试进行数据库查询,在那里我搜索当前级别低于低库存级别的所有项目.运行查询时,我没有得到任何结果,我不知道为什么.

这是我的查询

public static function getLowStockItemsCache()
{
         dd(\DB::table('items')->where('current_level', '<', 'low_stock_level')->get());
    }
Run Code Online (Sandbox Code Playgroud)

当我死了并转储这个我得到一个空集合.

在我的数据库中,我有以下记录

在此输入图像描述

这两个字段都设置为int(11)

如果我反转查询,我会得到所有13条记录.

我错过了一些小事,因为它让我很困惑,应该很简单.

php mysql laravel eloquent

2
推荐指数
1
解决办法
1万
查看次数

如何引用具有半冒号的对象

我正在使用AngularJS和WordPress Rest API.我正在发出一个返回对象的get请求.要获得特色图像,我必须使用'?embed'参数,该参数是另一个名为_embedded的对象.

问题是我希望在_embedded里面的对象叫做wp:featuredmedia.如果我在角度中这样引用它我会得到一个语法错误.

这是我的代码

$http.get(queries[0], {'cache': true}).
    then(function(response) {
        $scope.careers_title = strip(response.data.title.rendered);
        $scope.careers_content = strip(response.data.content.rendered);
        $scope.careers_feature_image = strip(response.data.featured_media);
        console.log(response.data._embedded);
    });
Run Code Online (Sandbox Code Playgroud)

console.log返回此信息

Object {author: Array[1], wp:featuredmedia: Array[1], wp:term: Array[2]}author: Array[1]wp:featuredmedia: Array[1]0: Object_links: Objectalt_text: ""author: 1date: "2016-04-25T09:33:52"id: 46link: "http://localhost:8888/rubis/wordpress/energy-efficiency/tp-roundall/"media_details: Objectmedia_type: "image"mime_type: "image/png"slug: "tp-roundall"source_url: "http://localhost:8888/rubis/wordpress/wp-content/uploads/2016/04/tp-roundall.png"title: Objecttype: "attachment"__proto__: Objectlength: 1__proto__: Array[0]wp:term: Array[2]__proto__: Object
Run Code Online (Sandbox Code Playgroud)

php wordpress json angularjs wp-api

1
推荐指数
1
解决办法
2577
查看次数

标签 统计

php ×5

laravel ×3

angularjs ×2

eloquent ×2

laravel-5 ×2

javascript ×1

jpgraph ×1

json ×1

mysql ×1

wordpress ×1

wp-api ×1