我需要一个HTML5视频播放器的提示点.我找到了Cuepoint.js,除了这只是用于字幕之类的东西.当提示点被击中时,我需要除文本之外的其他内容.
我有点自己的提示点逻辑,但我觉得它没有那么高效.我正在处理一小部分时间,这不是什么大不了的事.我害怕当我遇到数百时,可能会导致一些性能问题.
这就是我提出的,它非常准确:
function timeUpdate(event)
{
var times = [3,8,13,19,25];
currentTime = player.currentTime();
$.each(times,function(key, value)
{
if (currentTime >= times[key] && currentTime <= times[key] + 0.3)
{
currentIndex++;
loadAssets(currentIndex);
}
});
}
Run Code Online (Sandbox Code Playgroud)
该times
数组只是一个例子.有没有更有效的方法来做到这一点,还是这样呢?
使用AngularJS
,清除文本字段值的正确方法是什么?我有一个输入字段,旁边有一个按钮.用户输入并按下按钮以清除或重置它.
我知道我可以ng-click
在按钮上添加一个事件并调用一个函数,但我不确定这是否是正确的方法.
现在我只有:
<input type="text" ng-model="searchQuery" />
<button class="btn" <!--do something here maybe?-->>
<i class="icon-search" ng-class="{'icon-refresh': searchQuery.length}"></i>
</button>
Run Code Online (Sandbox Code Playgroud) 我试图混淆我的angularjs应用程序,它正在打破.我知道这是框架的一个问题,他们试图通过$ inject方法来解决它.
http://docs.angularjs.org/tutorial/step_05请参阅"关于缩小的注意事项"部分.
为了解决这个问题,他们建 YourController.$inject = ['$scope', '$http'];
我继续这样做,以匹配我的应用程序,如下所示:
AventosController.$inject = ['$scope','$http','$q','controllerComm'];
VforumController.$inject = ['$scope','$http','$timeout','controllerComm'];
Run Code Online (Sandbox Code Playgroud)
嗯,它仍然无法正常工作.我在控制台中收到的错误是:
Error: Unknown provider: cProvider <- c <- controllerComm
无论如何要补救这个?
编辑
controllerComm
app.factory('controllerComm', ['$rootScope', function($rootScope)
{
var showVforum = {};
showVforum.result = false;
showVforum.prepBroadcast = function(val)
{
this.result = val;
this.broadcastVal();
}
showVforum.broadcastVal = function()
{
$rootScope.$broadcast('toggleVforum')
}
return showVforum;
}]);
Run Code Online (Sandbox Code Playgroud)
编辑2在混淆后无法正常工作
$scope.launchVforum = function()
{
$scope.installationVideo = ($scope.installationVideo) ? false : true;
controllerComm.prepBroadcast($scope.installationVideo);
}
Run Code Online (Sandbox Code Playgroud) 我有一个简单的表,每行有三行和两个值 - 日期和状态:
<tbody>
<tr>
<td>Red</td>
<td class="lastModified">{{item.redDate}}</td>
<td class="status">
<select id ="red" class="form-control" ng-change="update();" ng-model="item.redStatus">
<option value="" disabled="" selected="" class="ng-binding">Please select the value</option>
<option ng-selected="step.value === item.redStatus" ng-repeat="(key, step) in steps">{{ step.title }}</option>
</select>
</td>
</tr>
<tr>Green</tr>
<tr>
....
</tr>
</tbody>
Run Code Online (Sandbox Code Playgroud)
因此,红色,绿色和蓝色的简单日期和状态值.一个在下拉列表中 - 状态,第二个 - 只是输出日期.
在更改选择值时 - 我需要使用今天的日期更新日期.
`$scope.item.redDate = new Date();`
Run Code Online (Sandbox Code Playgroud)
是否有可能有一个功能,如ng-change="change();"
无法发送与更改ID ...
我有一个 angular 11 项目使用 angular 材料(也是 11)工作了一段时间。我刚刚将所有内容更新为 angular 12(包括材料)。材料中包含的 style.scss 现在在更新后失败。整个错误是:
./src/styles.scss - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Invalid CSS after "@include mat": expected 1 selector or at-rule, was ".core();"
on line 11 of src/styles.scss
>> @include mat.core();
---------^
at processResult (/Users/ronnieswietek/Sites/elysian-finder/modules/custom/elysian_finder/finder/node_modules/webpack/lib/NormalModule.js:676:19)
at /Users/ronnieswietek/Sites/elysian-finder/modules/custom/elysian_finder/finder/node_modules/webpack/lib/NormalModule.js:778:5
at /Users/ronnieswietek/Sites/elysian-finder/modules/custom/elysian_finder/finder/node_modules/loader-runner/lib/LoaderRunner.js:399:11
at /Users/ronnieswietek/Sites/elysian-finder/modules/custom/elysian_finder/finder/node_modules/loader-runner/lib/LoaderRunner.js:251:18
at context.callback (/Users/ronnieswietek/Sites/elysian-finder/modules/custom/elysian_finder/finder/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
at Object.callback (/Users/ronnieswietek/Sites/elysian-finder/modules/custom/elysian_finder/finder/node_modules/sass-loader/dist/index.js:54:7)
at Object.done [as callback] (/Users/ronnieswietek/Sites/elysian-finder/modules/custom/elysian_finder/finder/node_modules/neo-async/async.js:8069:18)
at options.error (/Users/ronnieswietek/Sites/elysian-finder/modules/custom/elysian_finder/finder/node_modules/node-sass/lib/index.js:293:32)
./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[5].rules[0].oneOf[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[5].rules[0].oneOf[1].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[5].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[5].rules[1].use[1]!./src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Invalid …
Run Code Online (Sandbox Code Playgroud) 现在我试图从select下拉列表获取值,但它返回undefined.事情在html级别,它按预期工作,这是我的代码:
<div class='subcontent'>
<input id="me" type="radio" class='choosemethod' ng-model="paymentmethod" value="Y"><label for="me" class='choosemethod'>Me</label>
<input id="company" type="radio" ng-model="paymentmethod" value="N" class='choosemethod'><label for="company" class='choosemethod'>My Company</label><br/>
<span class='helptext'>Who makes payments to this account?</span><span class='help' style='margin-left:20px;width:20px;height:20px;'>help</span>
</div>
<div class='paymentmethods subcontent' ng-switch on="paymentmethod">
<select ng-model='selectedmethod' ng-init="selectedmethod=Memethods[0]" id='methods' ng-switch-when='Y'>
<option ng-repeat="method in Memethods" value="{{method}}">{{method}}</option>
</select>
<select ng-model='selectedmethod' ng-init="selectedmethod=companies[0]" ng-switch-when='N' style='float:left'>
<option ng-repeat='companyoption in companies' value="{{companyoption}}">{{companyoption}}</option>
</select>
<div class='clear'></div>
<label for ='methods'>Payment Method</label><span class='help' style='margin-left:20px;width:20px;height:20px;'>help</span>
</div>
Run Code Online (Sandbox Code Playgroud)
在js中:
$scope.Memethods = ['Same as Card/Account Name','American Express','American Express Corp','Cash','Checking','MasterCard','My Visa','VISA'];
$scope.companies = ['Company …
Run Code Online (Sandbox Code Playgroud) 我是laravel(实际上是任何PHP框架)的新手,但是对于PHP来说并不陌生.我创建了我的第一个项目,并设法使用预建Auth
系统登录.我创建了一个新的路由,控制器和模型AccountSettings
,当我转到/account
它预先填入登录的用户帐户信息(名称和电子邮件)
Route::get('account', 'AccountSettingsController@index');
Route::post('account', 'AccountSettingsController@updateAccount');
Run Code Online (Sandbox Code Playgroud)
当我点击表单上的提交按钮时,我可以看到我正在发布的表单数据(名称,电子邮件和_token);
我AccountSettingsController
是:
<?php namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\AccountSettings;
use Input;
use Request;
use Auth;
class AccountSettingsController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
return view('AccountSettings/index');
}
public function updateAccount()
{
var_dump(Input::all());
return view('AccountSettings/index');
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试通过以下方式保存用户信息:
public function updateAccount()
{
$id = Auth::user()->id;
$user = User::find($id);
$user->name = Request::input('name');
$user->email = Request::input('email');
$user->save(); …
Run Code Online (Sandbox Code Playgroud) 我知道设置一个控制器,服务,模型等来准备缩小.我有大约20个控制器,模型和服务作为单独的文件,我想将它们缩小并连接成一个JS文件进行生产.
要了解我如何设置这些文件,这是一个示例:
VforumJS.controller('MainController', ['$scope', '$location', '$sce', 'MainModel', 'LogModel', 'MainDebug', 'timecode', 'Idle', function($scope, $location, $sce, MainModel, LogModel, MainDebug, timecode, Idle)
{
...
}]);
Run Code Online (Sandbox Code Playgroud)
缩小后,我收到错误
Failed to instantiate module VforumJS due to:
Error: [$injector:unpr] http://errors.angularjs.org/1.4.1/$injector/unpr?p0=a
Run Code Online (Sandbox Code Playgroud)
如果我点击错误链接,它说 Unknown provider: a
这是我的模块创建的地方
var VforumJsConfig = function($routeProvider, $locationProvider, localStorageServiceProvider)
{
localStorageServiceProvider.setPrefix('vforumdesktop');
$locationProvider.html5Mode(true);
$routeProvider
.when('/', {
...
})
.otherwise({
...
});
};
var VforumJS = angular.module('VforumJS', ['ngRoute','LocalStorageModule', 'ngTouch', 'ui-rangeSlider','base64','ngIdle'])
.config(['$routeProvider', '$locationProvider', 'localStorageServiceProvider', VforumJsConfig])
.constant('LogTypes', {
LOGIN: 1,
IDLE_LOGOUT: 2,
MANUAL_LOGOUT: 3,
VFORUM_OPEN: 4,
VFORUM_CLOSE: 5
}) …
Run Code Online (Sandbox Code Playgroud) 我有一个路由资源Route::resource('projects', 'ProjectsController');
,当我运行时,route:list
我可以看到POST可用.
+--------+----------+--------------------------+------------------+--------------------------------------------------------------+-----------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+--------------------------+------------------+--------------------------------------------------------------+-----------------+
| | GET|HEAD | projects | projects.index | App\Http\Controllers\ProjectsController@index | auth |
| | POST | projects | projects.store | App\Http\Controllers\ProjectsController@store | auth |
| | GET|HEAD | projects/create | projects.create | App\Http\Controllers\ProjectsController@create | auth |
| | GET|HEAD | projects/{projects} | projects.show | App\Http\Controllers\ProjectsController@show | auth |
| | PUT | projects/{projects} | projects.update | App\Http\Controllers\ProjectsController@update | auth …
Run Code Online (Sandbox Code Playgroud) 我有一个内置AS3的视频播放器.我使用以下代码拍摄视频播放器的快照:
var uploadUrl = 'http://localhost:8000/assets/uploadframegrab';
var bitmap = new Bitmap();
var graphicsData : Vector.<IGraphicsData>;
graphicsData = container.graphics.readGraphicsData();
bitmap.bitmapData = GraphicsBitmapFill(graphicsData[0]).bitmapData;
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(bitmap.bitmapData);
var loader:URLLoader = new URLLoader();
var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var csrf:URLRequestHeader = new URLRequestHeader("X-CSRF-Token", csrfToken);
var request:URLRequest = new URLRequest(uploadUrl);
request.requestHeaders.push(header);
request.requestHeaders.push(csrf);
request.method = URLRequestMethod.POST;
request.data = jpgStream;
loader.load(request);
Run Code Online (Sandbox Code Playgroud)
我需要使用我的一个Laravel路线将编码上传到JPG.我的路线看起来像:
Route::post('assets/uploadframegrab', 'AssetController@uploadFramegrab');
当我运行AS3代码时,它调用laravel路由,但我的$request
变量似乎是空的.Request Payload
网络信息选项卡上显示所有标题和内容的属性包含的内容类似于图像文件的来源.
如果我做了return Response::json(['filedata' => $request]);
所有我得到的是这个:
filedata: {
attributes: {},
request: …
Run Code Online (Sandbox Code Playgroud) angularjs ×5
javascript ×4
laravel ×3
laravel-5 ×3
php ×3
select ×2
angular ×1
flash ×1
gruntjs ×1
html5 ×1
ng-options ×1
obfuscation ×1
scope ×1
typescript ×1
video ×1