我尝试使用自耕农,但我不知道如何使用自己的sass文件.
同
grunt server
Sass文件被观看并编译成
.tmp/styles/
但是没有引用已编译的样式表,除了 <link rel="stylesheet" href="styles/main.css">
那么,在开发过程中使用index.html中编译的sass文件的推荐方法是什么?
例如grunt server,如果我将样式更改app/styles/my.sass为.tmp/styles/my.css,则会被覆盖,并且它位于服务器之外(localhost:9000).因此,无法将其链接起来index.html.
随着grunt build一切内main.css包括my.sass但发展过程中,我不知道如何使用我自己的SASS文件index.html.
你能举个简单的例子吗?
这是默认的yeoman安装.我这样做了:
yo angular testapp/styles/style.sassgrunt server这个汇编style.sass成了.tmp/styles/style.cssstyle.css在html中包含它(对不起,这可能是一个愚蠢的问题,但我也是新人,也是自己的咕噜声)
这是来自yeoman的Gruntfile.js:
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var …Run Code Online (Sandbox Code Playgroud) REST api的多种形式更自然,更常用,例如/api/users或api/users/123.
但是对于某些资源来说并不自然,例如:
/api/login - 准确登录一个用户/api/profile - 获取已登录用户的个人资料此资源永远不会用于我的应用程序中的一个对象/模型.
另一方面,我读到在资源名称中混合复数和单数形式并不是一种好的做法(http://pages.apigee.com/web-api-design-ebook.html).
所以我考虑做什么:
/api/logins)/api/login或者/api/profile总是与一个对象/模型一起使用.什么是更好的方法?
我想用指令创建的字段创建表单.数据的数据绑定正常工作但验证不起作用.
这是html:
<body ng-controller="MainCtrl">
<h1>form</h1>
<form name="form">
<div ng-repeat="conf in config">
<div field data="data" conf="conf"></div>
</div>
</form>
<pre>{{data|json}}</pre>
</body>
Run Code Online (Sandbox Code Playgroud)
控制器和现场指令:
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.data = {name: '', age: ''}
$scope.config = [
{field: 'name', required:true},
{field: 'age'}
];
});
app.directive('field', function ($compile) {
return {
scope: {
data: '=',
conf: '='
},
link: function linkFn(scope, element, attrs) {
// field container
var row = angular.element('<div></div>');
// label
row.append(scope.conf.field + ': ');
// field input
var …Run Code Online (Sandbox Code Playgroud) 如果不是在PHP中,可以使用一些命令行工具将PO文件转换为某种结构化格式,例如XML或其他一些我可以在PHP中简单处理的文件?
带有指令的HTML视图:
<div click aaa="aaa()" action="action"></div>
Run Code Online (Sandbox Code Playgroud)
控制器:我喜欢在$ scope.action中传递函数bbb():
app.controller('MainCtrl', function($scope) {
$scope.aaa = function () { alert('aaa'); }
$scope.bbb = function () { alert('bbb'); }
$scope.action = 'bbb()';
});
Run Code Online (Sandbox Code Playgroud)
指示:
app.directive('click', function () {
return {
scope: {
aaa: '&',
action: '&'
},
template:
'<button ng-click="aaa()">show aaa (work ok)</button>' +
'<button ng-click="action">show bbb (not work)</button>' +
'<br>How to pass ng-click action in variable into directive?'
}
});
Run Code Online (Sandbox Code Playgroud)
我不知道如何评价action被替换bbb().
这里是plunker:http://plnkr.co/edit/d8DtsNARKPPJwk2SO2WJ
我尝试使用业力和茉莉与自耕农创建e2e测试.在我的karma-e2e.conf.js添加茉莉花:
files = [
JASMINE,
JASMINE_ADAPTER,
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'test/e2e/**/*.js'
];
Run Code Online (Sandbox Code Playgroud)
一个需要异步测试,所以我需要使用runs,waits,waitsFor(https://github.com/pivotal/jasmine/wiki/Asynchronous-specs)
但如果我尝试使用它:
it('test', function () {
runs(function () {
...
});
});
Run Code Online (Sandbox Code Playgroud)
Scenatio test runner返回:
TypeError: Cannot call method 'runs' of null
at runs (http://localhost:8080/adapter/lib/jasmine.js:562:32)
at Object.<anonymous> (http://localhost:8080/base/test/e2e/eduUser.js:42:3)
at Object.angular.scenario.SpecRunner.run (http://localhost:8080/adapter/lib/angular-scenario.js:27057:15)
at Object.run (http://localhost:8080/adapter/lib/angular-scenario.js:10169:18)
Run Code Online (Sandbox Code Playgroud)
我不知道问题出在哪里.你能帮我吗?