我正在尝试使用带有一些ajax数据的prettyprint.问题是,当调用指令时,数据没有准备好,所以我得到未定义的变量输出.
Plunkr:http://plnkr.co/edit/fdRi2nIvVzT3Rcy2YIlK?p =preview
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope,$http) {
$scope.result = $http.get('data.json').success(function(result){
return result.data.dom
})
});
app.directive('prettyprint', function() {
return {
restrict: 'C',
link: function postLink(scope, element, attrs) {
element.html(prettyPrintOne(scope.result))
}
};
});
Run Code Online (Sandbox Code Playgroud) 我想基于数值范围使用ngSwitch.
我想基于ngSwitch更改显示三个不同的文本.但是,当我尝试在ng-switch-when中设置值范围时,我无法完成这项工作.这是可能的,还是应该使用ngIf而不是ngSwitch?
我想创建一个在某个时刻切换颜色的旋钮.例如,35为红色,70为黄色,100为绿色.
我也想把它变成动画.
这是我的小提琴:http://jsfiddle.net/Tropicalista/jUELj/6/
我的代码是:
enter code here
$(document).ready(function() {
$('.dial').val(13).trigger('change').delay(2000);
$(".dial").knob({
'min':0,
'max':100,
'readOnly': true,
'width': 120,
'height': 120,
'fgColor': '#b9e672',
'dynamicDraw': true,
'thickness': 0.2,
'tickColorizeValues': true,
'skin':'tron'
})
});
Run Code Online (Sandbox Code Playgroud) 我需要一种按其属性排序列表的方法。
我有这个笨蛋:http : //jsfiddle.net/Tropicalista/aF2aL/1/
但不知道地前进。我需要一种方法可以根据我在复选框中选择的内容来排序列表...
function myCtrl($scope){
$scope.friends = [
{
name: "Michael",
gender: "Male",
hair: "Brunette"
},
{
name: "George Michael",
gender: "Male",
hair: "Brunette"
},
{
name: "Gob",
gender: "Male",
hair: "Brunette"
},
{
name: "Tobias",
gender: "Male",
hair: "Black"
},
{
name: "Lindsay",
gender: "Female",
hair: "Blonde"
},
{
name: "Maeby",
gender: "Female",
hair: "Black"
}
];
$scope.orderBy = function(target){
$scope.groups = _.groupBy($scope.friends, target);
}
$scope.activeGroups = {};
Run Code Online (Sandbox Code Playgroud)
}
这是我的html:
<input type="checkbox" ng-click="orderBy('name')" />Name
<input type="checkbox" …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的angularjs应用程序使用prettyprint插件.
但不能使它有效.我创建了一个简单的指令和调用方法prettyPrint(),但代码没有格式化.
FIDDLE:http://jsfiddle.net/Tropicalista/yAv4f/2/
App.directive('test', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
$(element).prettyPrint()
}
};
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Vue中创建一个精选组.
小提琴:https://jsfiddle.net/Tropicalista/vwjxc5dq/
我试过这个:
<optgroup v-for="option in options" v-bind:label="option">
<option v-for="sub in option" v-bind:value="option.value">
{{ sub.text }}
</option>
</optgroup>
Run Code Online (Sandbox Code Playgroud)
我的数据:
data: {
selected: 'A',
options: {
First: [
{ text: 'One', value: 'A' },
{ text: 'Two', value: 'B' }
],
Second: [
{ text: 'Three', value: 'C' }
]
}
}
Run Code Online (Sandbox Code Playgroud) 我怎样才能在angularJs中按类名计算?
我尝试过:
$scope.numItems = function() {
$window.document.getElementsByClassName("yellow").length;
};
Run Code Online (Sandbox Code Playgroud)
Plunkr:http://plnkr.co/edit/ndCqpZaALfOEiYieepcn?p =preview
我需要显示正数或负数.问题是我从api获取数据,其中我有一个delta -X表示正数,X表示负数.
所以要显示我的数据,我需要乘以-1.
我有这个代码:
{{myData * -1}}
Run Code Online (Sandbox Code Playgroud)
但我需要一种方法来为我的数据添加一个+符号,以防它是积极的.如果我有(-120*-1)我应该得到+120.
我怎么能加上我的号码?
我有一个简单的包,我想使用控制器。当我尝试在我得到的路线中使用它时
Class App\Http\Controllers\Tropicalista\Admin\Controllers\DashboardController
does not exist
Run Code Online (Sandbox Code Playgroud)
我的 /routes/web.php 中有这个
Route::group([
'namespace' => '\Tropicalista\Admin\Controllers',
'prefix'=> 'admin'], function() {
Route::get('/', ['as' => 'admin.root', 'uses' => 'DashboardController@index']);
});
Run Code Online (Sandbox Code Playgroud)
我的控制器:
namespace Tropicalista\Admin\Controllers;
use Illuminate\Http\Request;
use Analytics;
use Carbon\Carbon;
use Spatie\Analytics\Period;
use Illuminate\Support\Collection;
use Illuminate\Routing\Controller;
class DashboardController extends Controller
{...}
Run Code Online (Sandbox Code Playgroud)
我认为是命名空间问题。那么如何调用包控制器呢?
这是我的表格:
<form method="post">
<input type="checkbox" name="ciccio" value="214124,qqqqq" />1
<input type="checkbox" name="ciccio" value="675656,fggggggggg" />2
<input type="checkbox" name="ciccio" value="125676,gfsdsasssss" />3
<input type="checkbox" name="ciccio" value="898797,looooooo" />4
<input type="submit" value="vai" />
</form>
Run Code Online (Sandbox Code Playgroud)
我需要在数据库中插入"form.ciccio"的值.当我转储该变量时,结果是:
Ciccio: 214124,qqqqq,675656,fggggggggg,125676,gfsdsasssss,898797,looooooo
Run Code Online (Sandbox Code Playgroud)
我尝试过使用:
<cfset testing = form["ciccio[]"]>
Run Code Online (Sandbox Code Playgroud)
但它没有用.我怎么解决这个问题?