我已經在這30分鐘,不能找出我在做什麼錯?設置css樣式angularjs
HTML:
<div ng-controller="main">
<div ng-style="mapheight">
<google-map center="center" zoom="zoom" style="height: inherit;"></google-map>
</div>
</div>
控制器:
angular.module('csApp.controllers', ["google-maps"]).
controller("main", function($scope) {
$scope.mapheight = "{'min-height':" + getHeight() + "px;}";
$scope.center = {
latitude: 45,
longitude: -73
};
$scope.zoom = 8;
function getHeight() {
return (window.innerHeight * .70);
}
})
沒有風格被應用於我的div。
當我將{{mapheight}}放到我的模板中時,我可以通過該變量,但隨後我必須將它傳遞給樣式屬性,這顯然不是我該如何做的。
我在這裏做錯了什麼?這是我帶角度的第一天,我差點流淚,因爲我甚至無法調整div的大小。
謝謝!
這裏是在我的控制器的變化:
$scope.mapHeight = { 'min-height': getHeight() };
總有一個「第一天」,這並不意味着流淚會有所幫助。 :) – dmahapatro