Anything in the view is implicitly attacked to $scope
In controller: $scope.bla
In html: {{ bla }}

Thus try $scope.app.advtyp



On Tuesday, June 9, 2015 at 10:57:32 AM UTC-4, Johan Printz wrote:
>
> I have this code
> <label class="item item-input item-select">
>     <div class="input-label">
>       Annonstyp
>     </div>
>     <select ng-model='app.advtyp'>
>       <option value='0'>Välj</option>
>       <option value='1'>Säljes</option>
>       <option value='2'>Köpes</option>
>       <option value='3'>Hyres</option>      
>     <option value='4'>Bortskänkes</option>      
>     <option value='5'>Önskas</option>      
>     </select>
>   </label>
>
> {{app.advtyp}}
>
>
>  <label class="item item-input" ng-show='app.annonstyp()'>
>     <span class="input-label">Pris</span>
>     <input type="number">
>   </label>
>
> When running it I get the corresponding value printed ({{app.advtyp}}) - 
> works. But I don't get the value back into the controller?
> My controller looks like
>
> .controller('AddAdvert', function($scope,$http) {
>      this.advtyp="";
>
> this.annonstyp = function () {
> console.log("-->"+this.advtyp+"<----");
> return this.advtyp!="0";
>           };
>
> })
>
> the function "annonstyp" never becomes aware about the new value - it's 
> alway empty.
> Why?
>
> I understand that this is basic questions but I am all new to Angular and 
> trying to learn.
> Best regards
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to