ng-controller

AngularJS controller for a tab

不羁岁月 提交于 2020-01-01 09:33:31
问题 I have three tabs in my page. I'm using tabset and tab according to Angular Bootstrap Docs. I set a controller for the <div> which has the tabset as <div ng-controller="Tabs" class="panel panel-default" id="tabs-panel"> <tabset class="panel-body"> <tab heading="Tab 1"> </tab> <tab heading="Tab 2"> </tab> <tab heading="Tab 3"> </tab> </tabset> </div> The corresponding page is But, when I try to add another controller for my 2nd tab as <div ng-controller="Tabs" class="panel panel-default" id=

AngularJS function in controller and factory not working when separated

为君一笑 提交于 2019-12-25 18:41:14
问题 angular.module('myFirstApp')// //begin controller .controller('myController',function($scope,$http,personFactory){ //hi im controller i need to call the http service from the factory //begin service //hi im service i dont want to live in controller.js , i want to live in app.js //can we put the service inside a factory which is in app.js file and get called using controller #1 $http.get('iphone.json').success(function(result){ $scope.ObjectArray = result; }).error(function(error){ alert(error

angular2 Validator Error: Template parse errors:(…)

假如想象 提交于 2019-12-25 04:12:23
问题 I have problem. In console i can see "Error: Template parse errors:(…)". I'm use: "@angular/common": "2.0.0-rc.6", "@angular/compiler": "2.0.0-rc.6", "@angular/core": "2.0.0-rc.6", My form looks like <form name="authForm" novalidate="" ng-submit="login()" class="md-padding" [ngFormModel]="form"> <div layout="column" class="layout-column"> <div class="md-form" style="margin-bottom: 64px; margin-top: 20px"> <input ngControl="" class="mdl-textfield__input" [(ngModel)]="user.number" name="number"

AngularJS two http get in one controller make problems

时光怂恿深爱的人放手 提交于 2019-12-24 00:55:46
问题 i have two http GET in one controller and sometimes it works and two of them are working. sometime only one http Get is work. and sometimes none of them is shown. any suggestions? }).controller("nextSidorAdminCtrl", function($scope,$rootScope,$http,$location,$state) { $http.get("/ShiftWeb/rest/admin/getallsettingtime") .then(function(response) { $scope.settingtimes = response.data; }); $http.get("/ShiftWeb/rest/admin/nextsidor") .then(function(response) { $scope.nextsidor = response.data; });

Pass value in-between angular JS controller and services

时光毁灭记忆、已成空白 提交于 2019-12-18 09:38:10
问题 I am trying to get the user query from html using ng-click . I want to make a https call using the value which I fetch from ng-click. I can see the data in Alert--1 but in Alert--2 i get undefined . on internet I read that passing values using services is the best practice.Please correct me if I am wrong. My controller mainApp.controller('searchController',function($scope,searchString){ $scope.getQuery = function(userq) // its ng-click="getQuery(userq)" on Search button { $scope.userq=userq;

Anglularjs passing value from Controller, State Resolve and Factory Service

心不动则不痛 提交于 2019-12-11 05:39:08
问题 Okay, I have three relevant files for my question/s.. App.js - app.config In my app.config passing value in the resolve using $stateParams is possible and I attain it. But how about the value is from the controller ? I need the provCode value to use it in my php select query . .state("editStudent", { abstract: true, url:"/student/:id", controller: "EditStudentController", templateUrl: "views/students/editStudent.html", resolve: { dataservice: 'dataservice', student: function(dataservice,

Setting ng-controller dynamically from a variable value

一曲冷凌霜 提交于 2019-12-10 13:58:13
问题 I am developing an application using angularJs and nodejs. Am struck at setting the name of the controller to the value of a variable from main controller. To explain it better, my index.html looks like this : <tbody ng-repeat="group in groups"> <tr ng-repeat="member in group.members" > <td rowspan="{{group.members.length}}" ng-hide="$index>=0"> </td> <td>{{member.taskName}}</td> <td><div class={{group.colorMe[0]}}>{{member.env}}</div> <button class="btn btn-info" ng-controller="member

AngularJS beginner: ng-controller not working

时间秒杀一切 提交于 2019-12-04 03:19:47
问题 I'm just trying to get my head around the basics of AngularJS. I tried writing a simple MVC app, but the controller doesn't seem to be working. The file can find the angular lib just find, I already tested that by excluding 'ng-controller'. <!DOCTYPE html> <html ng-app> <head> <script src='js/lib/angular.js'></script> <script> // controller function MyFirstCtrl($scope) { // model var employees = ['Christopher Grant', 'Monica Grant', 'Christopher Grant', 'Jennifer Grant']; $scope.ourEmployees

AngularJS beginner: ng-controller not working

馋奶兔 提交于 2019-12-01 17:39:19
I'm just trying to get my head around the basics of AngularJS. I tried writing a simple MVC app, but the controller doesn't seem to be working. The file can find the angular lib just find, I already tested that by excluding 'ng-controller'. <!DOCTYPE html> <html ng-app> <head> <script src='js/lib/angular.js'></script> <script> // controller function MyFirstCtrl($scope) { // model var employees = ['Christopher Grant', 'Monica Grant', 'Christopher Grant', 'Jennifer Grant']; $scope.ourEmployees = employees; } </script> </head> <body ng-controller='MyFirstCtrl'> <!-- view --> <h2>Number of

Angularjs: 'controller as syntax' and $watch

我与影子孤独终老i 提交于 2019-11-26 23:38:53
How to subscribe on property change when using controller as syntax? controller('TestCtrl', function ($scope) { this.name = 'Max'; this.changeName = function () { this.name = new Date(); } // not working $scope.$watch("name",function(value){ console.log(value) }); }); <div ng-controller="TestCtrl as test"> <input type="text" ng-model="test.name" /> <a ng-click="test.changeName()" href="#">Change Name</a> </div> Just bind the relevant context. $scope.$watch(angular.bind(this, function () { return this.name; }), function (newVal) { console.log('Name changed to ' + newVal); }); Example: http:/