0

Iam beginner at angularjs.I came to know that some built-in directives can create their own scope.I want to know which directives can create their own scope.

srujana
  • 433
  • 1
  • 10
  • 33
  • 1
    Go through this [Understanding scopes in AngularJS](https://github.com/angular/angular.js/wiki/Understanding-Scopes#directives) – Gangadhar Jannu Mar 20 '17 at 07:22
  • Possible duplicate of [What are the nuances of scope prototypal / prototypical inheritance in AngularJS?](http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs) *New AngularJS developers often do not realize that `ng-repeat`, `ng-switch`, `ng-view`, `ng-include` and `ng-if` all create new child scopes, so the problem often shows up when these directives are involved.* – georgeawg Mar 20 '17 at 07:23

1 Answers1

2

all directives can create their own scope called isolated scope. when you create directives you have three choices:

1- isolated scope

scope:{}

2-no scope and use parent scope

scope:false

3-inherit and access parent scope but new properties add to own scope not parent

scope:true
  • See [AngularJS Comprehensive Directive API Reference - Scopes](https://docs.angularjs.org/api/ng/service/$compile#-scope-) – georgeawg Mar 20 '17 at 07:29