What are directives in AngularJS?

Directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS’s HTML compiler ($compile) to attach a specified behavior to that DOM element or even transform the DOM element and its children.

Example:

{{ firstName + ” ” + lastName }}

In this example, the ng-app and ng-controller directives are used to define the AngularJS application and controller, respectively.

What is the purpose of the @interface and @implementation directives?

The @interface and @implementation directives are used to define a class in Objective-C.

@interface defines the class interface, which includes the class name, the superclass it inherits from, and any methods, properties, and instance variables the class has.

@implementation defines the class implementation, which includes the actual code for the methods, properties, and instance variables declared in the interface.

Example:

@interface MyClass : NSObject

@property (nonatomic, strong) NSString *name;

– (void)sayHello;

@end

@implementation MyClass

@synthesize name;

– (void)sayHello {
NSLog(@”Hello %@”, self.name);
}

@end