I would like to return to the scope of the service method for use and processing in the template.
But I found that I can not use the scope of services, I can use the rootscope, but I think this is not the right approach.
How can I easily value the service?
Thanks for any advice
Here is the code:
/ ** * Insert auto complete dropdown menu for project list * / This.getProjectListForAutocomplete = function {$ ("# autocompleteProjects") .KundoAutomimate ({Datasource: {Type: "Jason", Server filtering: true, transport: {read: function (option) {console.log ("list "); Console.log (options.data); API s. Dow HTPR (" POST ", $ rootScope.apiBaseUrl +" gpsaddress / search ", requestParams) .success (function (data, position, header, config) {break; }}) .error (f Quotes (data, st eats, headers, config) {});}}}, datattextfield: "city", data value field: "address.city", filter: "contains", minaltata: 1, change: jobs (e ) {Console.log ("change"); //console.log(e);}, select: function (e) {console.log ("select"); Var data item = this.dataItem (e.item .index ();; console.log (DataItem); // Here I need to set scope in the controller}}); };
Please see the demo below:
var app = Angular Module ('app', []); Returns {person: _person}}) app.controller ('fCtrl', function ($ scope, DataService) {$ Scope.person = dataService.person;});
& lt; Script src = "https: //ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js" & gt; & Lt; / Script & gt; & Lt; Div ng-app = "app" & gt; & Lt; Div ng-controller = "fctrl" & gt; & Lt; P & gt; First name: {{person.name}} & lt; / P & gt; & Lt; P & gt; Last name: {{person.surname}} & lt; / P & gt; Edit First Name: & lt; Input type: "text" ng-model = "person.name" /> & Lt; / Div & gt; & Lt; / Div & gt;
Comments
Post a Comment