gpt4 book ai didi

javascript - 如何修复 Angular 应用程序在 Plunker 中给出空白页面的问题?

转载 作者:行者123 更新时间:2023-11-28 12:14:52 24 4
gpt4 key购买 nike

刚刚在 AngularJS 中定义了一个应用程序“演示”

'use strict';

var app = angular.module('demo', []);
app.controller('DemoCtrl', function($scope) {
$scope.obj={language_selected : {'name':'Choose a language'}};
$scope.language_list = [{'name': 'english', 'url': 'https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/gb.png'},{'name': 'italian', 'url': 'https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/it.png'}];

});

现在相应地定义了一个HTML页面

<!DOCTYPE html>
<html lang="en" ng-app="demo">
<head>
<meta charset="utf-8">
<title>AngularJS ui-select</title>


<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular-sanitize.js"></script>


<link rel="stylesheet" href="select.css">

</head>

<body ng-controller="DemoCtrl">

<div class="select_list" ng-class='{active:active}' ng-click="active=!active">
<span ng-style="{'background-image':'url('+obj.language_selected.url+')'}">{{obj.language_selected.name}}</span>
<ul class="options">
<li class="select_list_option" ng-repeat="language in language_list" ng-click="obj.language_selected=language" ng-style="{'background-image':'url('+language.url+')'}">{{language.name}}</li>
</ul>
</div>
</body>
</html>

编辑:检查了 appName -> 'demo' & ng-app 是 demo & Controller 是 DemoCtrl & ng-controller 是 DemoCtrl。它被适本地定义。

骗子现在给出了一个空页面。

我在这里遗漏了什么吗? Plunker 链接在这里:http://next.plnkr.co/edit/nXsUgM7nEsfg7jXh

最佳答案

您忘记加载js代码,请添加

<script src="demo.js"></script>

这是笨蛋 http://next.plnkr.co/edit/g4yKhngP1TyJ8jLr

关于javascript - 如何修复 Angular 应用程序在 Plunker 中给出空白页面的问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51732450/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com