小编Sra*_*ray的帖子

AngularJS ui-router:如何全局解析所有路由的典型数据?

我有一个AngularJS服务,它与服务器通信并返回应用程序不同部分的翻译:

angular
     .module('utils')
     .service('Translations', ['$q','$http',function($q, $http) {
        translationsService = {
            get: function(section) {
                if (!promise) {
                    var q = $q.defer();
                    promise = $http
                            .get(
                                '/api/translations',
                                {
                                    section: section
                                })
                            .success(function(data,status,headers,config) {
                                q.resolve(result.data);
                            })
                            .error(function(data,status,headers,config){ 
                                q.reject(status);
                            });
                    return q.promise;
                }
            }
        };

        return translationsService;
    }]);
Run Code Online (Sandbox Code Playgroud)

节的名称作为函数的section参数传递get.

我正在使用AngularJS ui-router模块并遵循此处描述的设计模式

所以我有以下状态配置:

angular.module('app')
    .config(['$stateProvider', function($stateProvider) {
    $stateProvider
    .state('users', {
        url: '/users',
        resolve: {
            translations: ['Translations',
                function(Translations) {
                    return Translations.get('users');
                }
            ]            
        },
        templateUrl: '/app/users/list.html',
        controller: 'usersController',
        controllerAs: 'vm' …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angularjs-service angular-ui-router

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

CSS 虚线阴影

假设我有一个带虚下划线的跨度:

<span class="underline">Hello, I'm underlined text</span>

.underline {
  color: #444;
  font-size: 250%;
  display:inline-block;
  border-bottom: 1px dashed #444;
}
Run Code Online (Sandbox Code Playgroud)

我需要为下划线添加底部阴影。我认为 box-shadow 并非如此,唯一可能的解决方案是通过伪元素来实现。我正在这样做:

.underline:after {
  content:"";
  border-bottom: 1px dashed #ff0000;
  display: block;
 }
Run Code Online (Sandbox Code Playgroud)

这会在下划线上方显示红色虚线,但我需要在下划线下方执行此操作。这怎么可能?

提前致谢。

css pseudo-element

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

Git推错误:"![拒绝]开发 - >开发(非快进)"

我有一个提交列表(最新的第一个):

abcd4 message
abcd3 wrong commit message2
abcd2 wrong commit message1
abcd1 message
Run Code Online (Sandbox Code Playgroud)

我需要改变提交的信息abcd2abcd3.我是按照以下方式做的:

rebase -i abcd1
Run Code Online (Sandbox Code Playgroud)

然后,在交互模式取代我pickreword,更改必要提交信息并保存更改.这里一切都很好.

问题如下:分支被完全推送到Bitbucket,因此Bitbucket上也有错误的提交消息.

我试图推动更改,但得到错误:

 ! [rejected]        develop -> develop (non-fast-forward)
error: failed to push some refs to 'https://login@bitbucket.org/user/repository.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push …
Run Code Online (Sandbox Code Playgroud)

git bitbucket

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

Angularjs ng-repeat:迭代特殊对象字段

我有一个对象:

var options = {
    NAME_1 : "Name 1",
    TEXT_1 : "Description goes here",
    NAME_2 : "Name 2",
    TEXT_2 : "Description2 goes here",
};
Run Code Online (Sandbox Code Playgroud)

是否有可能在ng-repeat内迭代对象的字段?例如

<div ng-repeat="item in options">
    <span class="title">{{item.name}}</span>
    <span class="text">{{item.text}}</span>
</div>
Run Code Online (Sandbox Code Playgroud)

我将非常感谢任何建议.

提前致谢.

javascript angularjs angularjs-ng-repeat

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