为什么警报不angularjs显示 [英] why alert is not display in angularjs

查看:154
本文介绍了为什么警报不angularjs显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用要求的角度JS项目。我很能展现看法,但问题是,我不能够在得到警报JS登录按钮的点击。其实我告诉按钮点击一个警报。

I am trying to use require js in angular js project .I am able to show view but issue is that I am not able to get alert on "Login" button click .Actually I show One alert on button click .

下面是我的code

http://plnkr.co/edit/jv79297BZLiJpY66rKAc?p=$p$ PVIEW

 function ctrl($scope, $state) {

        $scope.login = function () {
          alert("Login is clicked")
        };

    }

我想我在控制台上有错误,为什么我不能够显示警报?

I think I got error on console that why I am not able to display alert ?

<一个href=\"http://errors.angularjs.org/1.2.12/ng/areq?p0=LoginCtrl&p1=not%20a%20function%2C%20got%20undefined\" rel=\"nofollow\">http://errors.angularjs.org/1.2.12/ng/areq?p0=LoginCtrl&p1=not%20a%20function%2C%20got%20undefined
    在错误(本机)

推荐答案

定义文件bootstrap.js块的伎俩传递控制器名称:

Passing the controller name in the define block of file bootstrap.js did the trick :

    define(['ionic', 'app', 'route', 'LoginCtrl'], function (ionic, app) {
        'use strict';


            angular.element().ready(function () {

                try {
                    console.log(app)
                    angular.bootstrap(document, [app.name]);
                } catch (e) {
                    console.error(e.stack || e.message || e);
                }
            });


    });     

您可以找到更新的plunker rel=\"nofollow\">

You can find the updated plunker here

这篇关于为什么警报不angularjs显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆