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 .
Here is my code
http://plnkr.co/edit/jv79297BZLiJpY66rKAc?p=preview
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 ?
http://errors.angularjs.org/1.2.12/ng/areq?p0=LoginCtrl&p1=not%20a%20function%2C%20got%20undefined at Error (native)
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);
}
});
});
You can find the updated plunker here