zoukankan      html  css  js  c++  java
  • angular.min.js:118 Error: [ng:areq] http://errors.angularjs.org/1.5.8/ng/areq?

    1、错误描述

    angular.min.js:118 Error: [ng:areq] http://errors.angularjs.org/1.5.8/ng/areq?p0=username&p1=not%20a%20function%2C%20got%20undefined
        at Error (native)
        at http://127.0.0.1:8020/AngularJS/js/angular.min.js:6:412
        at sb (http://127.0.0.1:8020/AngularJS/js/angular.min.js:23:18)
        at Pa (http://127.0.0.1:8020/AngularJS/js/angular.min.js:23:105)
        at http://127.0.0.1:8020/AngularJS/js/angular.min.js:89:310
        at ag (http://127.0.0.1:8020/AngularJS/js/angular.min.js:72:419)
        at p (http://127.0.0.1:8020/AngularJS/js/angular.min.js:64:262)
        at g (http://127.0.0.1:8020/AngularJS/js/angular.min.js:58:481)
        at g (http://127.0.0.1:8020/AngularJS/js/angular.min.js:58:498)
        at g (http://127.0.0.1:8020/AngularJS/js/angular.min.js:58:498)


    2、错误原因

    <!DOCTYPE html>
    <html ng-app>
    	<head>
    		<meta charset="UTF-8">
    		<title></title>
    		<script type="text/javascript" src="../js/angular.min.js" ></script>
    	</head>
    	<body>
    		<div ng-controller="username">
    			<input type="text" id="inp" ng-model="user.name">
    			<div>{{user.name}}</div>
    		</div>
    		<script>
    			function username($scope)
    			{
    				$scope.user = {name:"张丝丝"};
    			}
    		</script>
    	</body>
    </html>
    


    3、解决办法

    <!DOCTYPE html>
    <html ng-app="userApp">
    	<head>
    		<meta charset="UTF-8">
    		<title></title>
    		<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
    		<script>
    			var app = angular.module("userApp",[]);
    			app.controller("username",function($scope){
    				$scope.user = {name:"张丝丝"}
    			});
    		</script>
    	</head>
    	<body>
    		<div ng-controller="username">  
                <input type="text" id="inp" ng-model="user.name">  
                <div>{{user.name}}</div>  
            </div>  
    	</body>
    </html>


  • 相关阅读:
    Jquery 跨域问题
    Linux下scp的用法
    JZ2440_V3_内核驱动程序_点亮一个LED灯
    MATLAB GUIDE 上位机串口通信开发 绘制图形
    关于在DSP工程内数组、strnpy函数、atoi函数的使用心得
    Visio中手绘图形的填充
    Ubuntu16.04NFS配置与ARM开发板互传文件_挂载和卸载
    树莓派压力测试工具STui + Stress的使用
    如何将代码优雅的插入到word中
    常用正则表达式
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13314091.html
Copyright © 2011-2022 走看看