在angularjs

时间:2016-06-02 11:06:30

标签: javascript angularjs

我正在尝试将此背景图像添加到我在angularjs中进行的此平铺布局。

的javascript

angular.module('MyApp', ['ngMaterial', 'ngMessages'])
    .controller('gridListDemoCtrl', function($scope) {

        this.tiles = buildGridModel({
            icon: "avatar:svg-",
            title: "Svg-",
            background: ""
        });

        function buildGridModel(tileTmpl) {
            var it, results = [];

            for (var j = 11; j > 0; j--) {

                it = angular.extend({}, tileTmpl);
                it.icon = it.icon + (j - 1);
                it.title = it.title + (j - 1);
                it.span = { row: 1, col: 1 };

                switch (j - 1) {
                    case 0:
                        it.title = "My First Video";
                        break;
                    case 1:
                        it.background = "red";
                        it.title = "Yo";
                        break;
                    case 2:
                        it.background = "green";
                        break;
                    case 3:
                        it.background = "darkBlue";
                        break;
                    case 4:
                        it.background = "blue";
                        break;
                    case 5:
                        it.background = "yellow";
                        break;
                    case 6:
                        it.background = "pink";
                        break;
                    case 7:
                        it.background = "darkBlue";
                        break;
                    case 8:
                        it.background = "purple";
                        break;
                    case 9:
                        it.background = "deepBlue";
                        break;
                    case 10:
                        it.background = "lightPurple";
                        break;
                    case 11:
                        it.background = "yellow";
                        break;
                }

                results.push(it);
            }
            return results;
        }
    })
    .config(function($mdIconProvider) {
        $mdIconProvider.iconSet("avatar", 'icons/avatar-icons.svg', 128);
    });

我该怎么办?我应该添加/更改指令吗?如果需要,我可以发布html / css。谢谢你的帮助。

0 个答案:

没有答案