Hola, tengo lo sgte :
Código:
<body ng-app="myApp" class="ng-cloak">
<div class="generic-container" ng-controller="InitController as initCRTL">
<div class="panel panel-default">
<div class="formcontainer">
<form ng-submit="initCRTL.initCRM()" name="myForm" class="form-horizontal">
<div class="row">
<div class="form-group col-md-12">
<label class="col-md-2 control-lable" for="uname">Usuario</label>
<div class="col-md-7">
<input type="text" value="user1" ng-model="initCRTL.crm.username" id="uname" class="username form-control input-sm" placeholder="Enter your name" required/>
<div class="has-error" ng-show="myForm.$dirty">
<span ng-show="myForm.uname.$error.required">This is a required field</span>
<span ng-show="myForm.uname.$invalid">This field is invalid </span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-actions floatRight">
<input type="submit" value="Iniciar" class="btn btn-primary btn-sm" ng-disabled="myForm.$invalid">
</div>
</div>
</form>
</div>
</div>
</div>
</body>
my app.js
Código:
'use strict';
var App = angular.module('myApp',[]);
y mi controlador.js:
Código:
'use strict';
App.controller('InitController', ['$scope', 'InitService', function($scope, InitService) {
var self = this;
self.crm = {username:''};
self.initCRM = function(crm){
alert("entra");
MainService.initCRM(crm);
};
self.submit = function() {
alert("lol");
self.initCRM(self.crm);
};
}]);
Pero no me muestra los alert, no me aparece ningun error con el firebug
Un saludo